User forums > Using Code::Blocks

CodeBlocks can't find #include <Random.h>

(1/2) > >>

hubert:
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

oBFusCATed:
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>

hubert:
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

Miguel Gimenez:
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.

hubert:
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

Navigation

[0] Message Index

[#] Next page

Go to full version