Author Topic: CodeBlocks can't find #include <Random.h>  (Read 5005 times)

Offline hubert

  • Single posting newcomer
  • *
  • Posts: 5
CodeBlocks can't find #include <Random.h>
« on: August 08, 2017, 09:19:53 am »
Hello,

in my Header I have #include <Random.h>
in my "Settings" > "Compiler" >
I have:

 "Custom variables"
BOOSTINCLUDE = C:/MinGW/boost/include/boost
BOOSTVARIANTE = -mgw-mt
BOOSTLIBDIR = C:\MinGW\boost\lib

"Linker Settings"
boost_system$(BOOSTVARIANTE)
boost_filesystem$(BOOSTVARIANTE)

"Search directories"
"Compiler"
%USERPROFILE%\Documents\cppbuch\include
$(BOOSTVARIANTE)

"Linker"
$(BOOSTLIBDIR)

But when compiling it says:
fatal error. Random.h: No such file or Directory
=== Build failed: 1 error(s), 0 warning(s)     ...and so on

Can anybody please help ?

Greatings
hubert


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: CodeBlocks can't find #include <Random.h>
« Reply #1 on: August 08, 2017, 09:29:11 am »
If random is a boost header you have two errors:
1. C:/MinGW/boost/include/boost should be C:/MinGW/boost/include
2. the include should be <boost/random.h>
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline hubert

  • Single posting newcomer
  • *
  • Posts: 5
Re: CodeBlocks can't find #include <Random.h>
« Reply #2 on: August 08, 2017, 12:02:52 pm »
Hello oBFusCATed ,

thanks, but that did not work.
I've got the code from a book's Website, which's test programms all worked up to now (when not using boost or any random method).

Any idea ?

Greatings
hubert

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1557
Re: CodeBlocks can't find #include <Random.h>
« Reply #3 on: August 08, 2017, 01:01:46 pm »
Do you have boost? Not all MingW distros have integrated boost.

If you have boost, locate random.h and use the path in Search directories -> Compiler (leave the custom variable step for a second stage). As Obfuscated said, you should remove the last "boost" from the path and use #incude "boost/random.h".

The name of the include file is random.h, not Random.h; in Windows this is not an issue, but if you want code portability you should use the correct name from start.

Offline hubert

  • Single posting newcomer
  • *
  • Posts: 5
Re: CodeBlocks can't find #include <Random.h>
« Reply #4 on: August 08, 2017, 01:17:36 pm »
Hello Miguel,

1.) I have boost
2.) I removed the last "boost" from "Custom variables" Setting so now it says
BOOSTINCLUDE = C:/MinGW/boost/include
BOOSTVARIANTE = -mgw-mt
BOOSTLIBDIR = C/MinGW/boost/lib
Although it made sense to me to have the final "boost" here, because when installing the MinGW
I got the boost-stuff in the directories:
C:/MinGW/boost/lib
and
C:/MinGW/boost/include/boost/boost
WHICH (three times boost !?) looks redundant or weired, doesn't it ?

Greatings
hubert

3.) #include <boost/random.h>   did not help


Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1557
Re: CodeBlocks can't find #include <Random.h>
« Reply #5 on: August 08, 2017, 01:53:03 pm »
Did you edit Search directories -> Compiler? The content you posted didn't have the BOOSTINCLUDE variable. Add C:/MinGW/boost/include/boost to search directories and test again; when you get it working do the conversion to a custom variable.

Offline hubert

  • Single posting newcomer
  • *
  • Posts: 5
Re: CodeBlocks can't find #include <Random.h>
« Reply #6 on: August 08, 2017, 03:04:07 pm »
Hello Miguel,

yes, I  edited the  Search directories -> Compiler and I have the BOOSTINCLUDE variable.
I tried your idea >>>
Add C:/MinGW/boost/include/boost to search directories and test again....

It does not work !
I've got to go now, but I will continue on that Problem tomorrow and then I can send you all the configurations of mine...
Thanks, perhaps Hearing of you tomorrow

hubert

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Krice

  • Almost regular
  • **
  • Posts: 150
Re: CodeBlocks can't find #include <Random.h>
« Reply #8 on: August 10, 2017, 10:09:44 am »
Boost document and their example seems to indicate that you don't include random.h but one or more of random engine .hpp headers in this list:

http://www.boost.org/doc/libs/1_64_0/doc/html/boost_random/reference.html#headers

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1557
Re: CodeBlocks can't find #include <Random.h>
« Reply #9 on: August 10, 2017, 02:07:01 pm »
In fact random.h does not exist, the correct name is random.hpp