Re: newbie boost sample compile program
Martin Lemieux
[...] MS Visual C++ 6 generates the following similar error when attempting to compile simple_ls.cpp
c:\boost\include\boost-1_32\boost\filesystem\operations.hpp(18) : fatal error C1083: Cannot open include file: 'boost/filesystem/path.hpp': No such file or directory
2b) On MSDEV6, add "c:\boost\include\boost-1_32" in your project settings. More specifically in the "C++" tab, under "Preprocessor" category (drop-down list), and at "Additional include directories:". I did this and I can now build, but I get a linker error: LINK : fatal error LNK1104: cannot open file "libboost_filesystem-vc6-sgd-1_32.lib" Thanks.
Brian Gaber
2) Then make sure your compiler command line at least mention "-I /user/local/include" or "-I $(INC)" where INC ~includes~ "/user/local/include".
I get further, here is the new AIX compiler error:
xlc++ -o simple_ls simple_ls.cpp -I /usr/local/include
ld: 0711-317 ERROR: Undefined symbol: .boost::filesystem::initial_path() [...] ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.
As I suspected, those are linker errors! That means steps 1 and 2 worked. Now (step 3), you need to specify the directory where to find the boost libraries, as well as the lirbary file(s) for the linker to link with. At this point you have plenty of choices: static/dynamic, multi-thread or not, debug/release. 3a) You might have some of the following library files in your AIX [...]/boost/lib directory: boost_filesystem-AIX-mt-1_31.so boost_filesystem-AIX-mt-1_31.lib boost_filesystem-AIX-mt-gd-1_31.so boost_filesystem-AIX-mt-gd-1_31.lib On your compiler command line, add "-L /usr/local/include/boost-1_32/boost/lib" (or make a symbolic link as you did for the include directory towards /usr/local/include/boost/lib and use this one instead, as you wish). Then (usually at the end of the command line) add the library file you like. May I the a static one (.lib). Your command line should look like: xlc++ -o simple_ls simple_ls.cpp -I /usr/local/include - L /usr/local/include/boost-1_32/boost/lib boost_filesystem-AIX-mt-1_31.lib
2a) On AIX, look inside your makefile.
What am I looking for?
Ignore the makefile since you're using the command line directly.
[...] 2b) On MSDEV6, add "c:\boost\include\boost-1_32" in your project settings. More specifically in the "C++" tab, under "Preprocessor" category (drop-down list), and at "Additional include directories:".
I did this and I can now build, but I get a linker error:
LINK : fatal error LNK1104: cannot open file "libboost_filesystem-vc6-sgd- 1_32.lib"
3b) On MSDEV6, i) add "libboost_filesystem-vc6-sgd-1_32.lib" in your project settings. More specifically in the "Link" tab, under "Input" category (drop-down list), and at "Object/Library modules:". ii) and add "c:\boost\include\boost-1_32\boost\lib" in "Additional library path:". It should work.
participants (2)
-
Brian Gaber
-
Martin Lemieux