Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: hubert 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
-
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>
-
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
-
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.
-
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
-
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.
-
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
-
Post a build log!
http://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)
-
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
-
In fact random.h does not exist, the correct name is random.hpp