Hi all,
I've got this really simple C++ program that's using the
Boost.Filesystem library:
#include <iostream>
#include
int main()
{
boost::filesystem::path pathname = "/usr/local/bin";
std::cout << pathname.string() << std::endl;
return 0;
}
It compiles fine, and I can get it to link to use the shared object:
g++ -I/usr/local/include/boost-1_35 -o test test.cpp
-lboost_filesystem-gcc42-mt-1_35
But I want to statically link instead. I've tried this and other
similar combinations:
g++ -I/usr/local/include/boost-1_35 -o test test.cpp
-lboost_filesystem-gcc42-mt-s-1_35 -static -static-libgcc
and I'm always getting these linker errors:
/tmp/ccoiFv2v.o: In function
`__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x1dc): undefined reference to
`boost::system::get_system_category()'
test.cpp:(.text+0x1e6): undefined reference to
`boost::system::get_posix_category()'
test.cpp:(.text+0x1f0): undefined reference to
`boost::system::get_posix_category()'
test.cpp:(.text+0x1fa): undefined reference to
`boost::system::get_system_category()'
collect2: ld returned 1 exit status
I've built Boost in full and have got these Boost.Filesystem libraries
in /usr/local/lib:
libboost_filesystem-gcc42-1_35.a
libboost_filesystem-gcc42-1_35.so
libboost_filesystem-gcc42-1_35.so.1.35.0
libboost_filesystem-gcc42.a
libboost_filesystem-gcc42-d-1_35.a
libboost_filesystem-gcc42-d-1_35.so
libboost_filesystem-gcc42-d-1_35.so.1.35.0
libboost_filesystem-gcc42-d.a
libboost_filesystem-gcc42-d.so
libboost_filesystem-gcc42-mt-1_35.a
libboost_filesystem-gcc42-mt-1_35.so
libboost_filesystem-gcc42-mt-1_35.so.1.35.0
libboost_filesystem-gcc42-mt.a
libboost_filesystem-gcc42-mt-d-1_35.a
libboost_filesystem-gcc42-mt-d-1_35.so
libboost_filesystem-gcc42-mt-d-1_35.so.1.35.0
libboost_filesystem-gcc42-mt-d.a
libboost_filesystem-gcc42-mt-d.so
libboost_filesystem-gcc42-mt-s-1_35.a
libboost_filesystem-gcc42-mt-s.a
libboost_filesystem-gcc42-mt-sd-1_35.a
libboost_filesystem-gcc42-mt-sd.a
libboost_filesystem-gcc42-mt.so
libboost_filesystem-gcc42-s-1_35.a
libboost_filesystem-gcc42-s.a
libboost_filesystem-gcc42-sd-1_35.a
libboost_filesystem-gcc42-sd.a
libboost_filesystem-gcc42.so
I hope someone can help me because I just can't see what I'm doing wrong!
Graham