Re: newbie boost sample compile program
"Martin Lemieux" < mailto:lemieux@cae.com lemieux<at>cae.com> wrote:
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 AIX v5.2 here are the boost_filesystem* libraries I have under /usr/local/lib libboost_filesystem-xlc-1_32.a libboost_filesystem-xlc-1_32.so libboost_filesystem-xlc-d-1_32.a libboost_filesystem-xlc-d-1_32.so libboost_filesystem-xlc-d.a libboost_filesystem-xlc-d.so libboost_filesystem-xlc-mt-1_32.a libboost_filesystem-xlc-mt-1_32.so libboost_filesystem-xlc-mt-d-1_32.a libboost_filesystem-xlc-mt-d-1_32.so libboost_filesystem-xlc-mt-d.a libboost_filesystem-xlc-mt-d.so libboost_filesystem-xlc-mt.a libboost_filesystem-xlc-mt.so libboost_filesystem-xlc.a libboost_filesystem-xlc.so
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).
On AIX (maybe all unix's) boost libraries are found in /usr/local/lib
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:
No boost libraries with a .lib extension
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
the actual xlc++ compiler command line that worked was: xlc++ -o simple_ls simple_ls.cpp -I /usr/local/include -lboost_filesystem-xlc-1_32 -L/usr/local/lib NOTE: after the -l the three letters "lib" are removed from the front of the actual library name.
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:".
On my Windows 2000 the file "libboost_filesystem-vc6-sgd-1_32.lib" is found in c:\boost\lib Martin, thanks for your help. I would have never got this working without your assistane.
Brian Gaber
[ML]
3a) You might have some of the following library files in your AIX [...]/boost/lib directory:
[BG] On AIX (maybe all unix's) boost libraries are found in /usr/local/lib
Right!
[BG] No boost libraries with a .lib extension
[BG] xlc++ -o simple_ls simple_ls.cpp -I /usr/local/include -lboost_filesystem-xlc-1_32 -L/usr/local/lib NOTE: after the -l the three letters "lib" are removed from the front of the actual
Right! They are .a library
name.
Right!
[BG] On my Windows 2000 the file "libboost_filesystem-vc6-sgd-1_32.lib" is found in c:\boost\lib
Perfect!
Martin, thanks for your help. I would have never got this working without your assistance.
It has been a while I did not touch a Unix machine! It was a good refresh anyway.
participants (2)
-
Brian Gaber
-
Martin Lemieux