[Boost-users] newbie boost sample compile program

405 views
Skip to first unread message

Brian Gaber

unread,
Nov 30, 2004, 1:37:52 PM11/30/04
to boost...@lists.boost.org
I have installed boost on both Windows and AIX and get the same problem when I try to compile the simple_ls.cpp program that boost provides.
 
In AIX the boost hpp files get installed in /usr/local/include/boost-1_32/boost/...
 
I created /usr/local/include/boost/... with this command:  ln -s /usr/local/include/boost-1_32/boost /usr/local/include/boost
 
In Windows the boost hpp files get installed C:\boost-1_32\boost\...
 
In AIX when I try to compile simple_ls.cpp I get the following:
 
"/usr/local/include/boost/filesystem/operations.hpp", line 18.10: 1540-0836 (S) The #include file <boost/filesystem/path.hpp> is not found.
"/usr/local/include/boost/filesystem/operations.hpp", line 19.10: 1540-0836 (S) The #include file <boost/shared_ptr.hpp> is not found.
"/usr/local/include/boost/filesystem/operations.hpp", line 21.10: 1540-0836 (S) The #include file <boost/iterator.hpp> is not found.
"/usr/local/include/boost/filesystem/operations.hpp", line 22.10: 1540-0836 (S) The #include file <boost/cstdint.hpp> is not found.
"/usr/local/include/boost/filesystem/operations.hpp", line 27.10: 1540-0836 (S) The #include file <boost/config/abi_prefix.hpp> is not found.
"/usr/local/include/boost/filesystem/operations.hpp", line 149.10: 1540-0836 (S) The #include file <boost/config/abi_suffix.hpp> is not found.
my simple_ls.cpp currently has the following include statements:
 
#include "/usr/local/include/boost/filesystem/operations.hpp"
#include "/usr/local/include/boost/filesystem/path.hpp"
#include <iostream>
 
simple_ls.cpp came with the following include statements which generate similar errors to those above:
 
#include "boost/filesystem/operations.hpp"
#include "boost/filesystem/path.hpp"
#include <iostream>
 
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
 
 
    Thanks for any tips.

Martin Lemieux

unread,
Dec 1, 2004, 4:50:54 PM12/1/04
to boost...@lists.boost.org
Brian Gaber <Brian.Gaber <at> PWGSC.GC.CA> writes:

> [...] my simple_ls.cpp
> currently has the following include statements:
>
> #include "/usr/local/include/boost/filesystem/operations.hpp"
> #include "/usr/local/include/boost/filesystem/path.hpp"
> #include <iostream>

1) You describe to much path information in the #include directive in
simple_ls.cpp . Like the Boost's .hpp, just start with "boost/(...).hpp".

2) Then make sure your compiler command line at least mention
"-I /user/local/include" or "-I $(INC)" where INC
~includes~ "/user/local/include".

2a) On AIX, look inside your makefile.

> [...] 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:".

You should be able to compile.




_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Brian Gaber

unread,
Dec 2, 2004, 12:38:35 PM12/2/04
to boost...@lists.boost.org, lem...@cae.com
Martin Lemieux <lemieux<at>cae.com> writes:

1) You describe to much path information in the #include directive in
simple_ls.cpp . Like the Boost's .hpp, just start with "boost/(...).hpp".

I fixed the path information in the #include directive to be "boost/filesystem/...

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-317 ERROR: Undefined symbol: boost::filesystem::native(const std::basic_string<char,std::char_traits<char>,std::allocator<char> >&)
ld: 0711-317 ERROR: Undefined symbol: .boost::filesystem::path::path(const char*,bool(*)(const std::basic_string<char,std::char_traits<char>,std::allocator<char> >&))
ld: 0711-317 ERROR: Undefined symbol: .boost::filesystem::system_complete(const boost::filesystem::path&)
ld: 0711-317 ERROR: Undefined symbol: .boost::filesystem::exists(const boost::filesystem::path&)
ld: 0711-317 ERROR: Undefined symbol: .boost::filesystem::path::native_file_string() const
ld: 0711-317 ERROR: Undefined symbol: .boost::filesystem::is_directory(const boost::filesystem::path&)
ld: 0711-317 ERROR: Undefined symbol: .boost::filesystem::path::native_directory_string() const
ld: 0711-317 ERROR: Undefined symbol: .boost::filesystem::path::leaf() const
ld: 0711-317 ERROR: Undefined symbol: .boost::filesystem::detail::dir_itr_init(boost::shared_ptr<boost::filesystem::detail::dir_itr_imp>&,const boost::filesystem::path&)
ld: 0711-317 ERROR: Undefined symbol: .boost::filesystem::detail::dir_itr_dereference(const boost::shared_ptr<boost::filesystem::detail::dir_itr_imp>&)
ld: 0711-317 ERROR: Undefined symbol: .boost::filesystem::detail::dir_itr_increment(boost::shared_ptr<boost::filesystem::detail::dir_itr_imp>&)
ld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.

2a) On AIX, look inside your makefile.

What am I looking for?

> [...] 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.

Martin Lemieux

unread,
Dec 2, 2004, 2:45:35 PM12/2/04
to boost...@lists.boost.org
Brian Gaber <Brian.Gaber <at> PWGSC.GC.CA> writes:

> 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.

Brian Gaber

unread,
Dec 3, 2004, 3:04:55 PM12/3/04
to boost...@lists.boost.org
"Martin Lemieux" <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.

Martin Lemieux

unread,
Dec 14, 2004, 11:32:05 AM12/14/04
to boost...@lists.boost.org
Brian Gaber <Brian.Gaber <at> PWGSC.GC.CA> writes:

> [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
>

Right! They are .a

> [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
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.
Reply all
Reply to author
Forward
0 new messages