
Hi, I have done some additional testing on th eproblem that I reported yesterday, and I have found that the problem I was having with static linking under gcc 2.95.3 also occurs on gcc 3.2.2. I get basically the same error message (see below). I guess that the reason I get the message for the static linking but not for the dynamic linking might be that the undefined references in a shared library are ok as long as those functions are not called. Is that correct? I looked at the code, and as far as I can tell, the functions that the compiler is complaining about are in fact defined. Does anyone have any suggestions? Thanks, Daniel g++ -L $HOME/linux/lib/boost/lib -static -lboost_filesystem -gcc -I $HOME/linux/lib/boost/include/boost-1_31 test_boost.cxx /tmp/ccP4gcx3.o(.text+0x19): In function `main': : undefined reference to `boost::filesystem::initial_path()' /tmp/ccP4gcx3.o(.text+0x3e): In function `main': : undefined reference to `boost::filesystem::native(std::basic_string<char, std: :char_traits<char>, std::allocator<char> > const&)' /tmp/ccP4gcx3.o(.text+0x4f): In function `main': : undefined reference to `boost::filesystem::path::path[in-charge](char const*, bool (*)(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&))' /tmp/ccP4gcx3.o(.text+0x5f): In function `main': : undefined reference to `boost::filesystem::system_complete(boost::filesystem:: path const&)' /tmp/ccP4gcx3.o(.text+0x114): In function `main': : undefined reference to `boost::filesystem::exists(boost::filesystem::path cons t&)' /tmp/ccP4gcx3.o(.text+0x137): In function `main': : undefined reference to `boost::filesystem::path::native_file_string() const' /tmp/ccP4gcx3.o(.text+0x1ba): In function `main': : undefined reference to `boost::filesystem::is_directory(boost::filesystem::pat h const&)' /tmp/ccP4gcx3.o(.text+0x1dd): In function `main': : undefined reference to `boost::filesystem::path::native_directory_string() con st' /tmp/ccP4gcx3.o(.text+0x28c): In function `main': : undefined reference to `boost::filesystem::is_directory(boost::filesystem::pat h const&)' /tmp/ccP4gcx3.o(.text+0x2c0): In function `main': : undefined reference to `boost::filesystem::path::leaf() const' /tmp/ccP4gcx3.o(.text+0x342): In function `main': : undefined reference to `boost::filesystem::path::leaf() const' /tmp/ccP4gcx3.o(.text+0x404): In function `main': : undefined reference to `boost::filesystem::path::leaf() const' /tmp/ccP4gcx3.o(.text+0x572): In function `main': : undefined reference to `boost::filesystem::path::native_file_string() const' /tmp/ccP4gcx3.o(.gnu.linkonce.t._ZN5boost10filesystem18directory_iteratorC1ERKNS 0_4pathE+0x1f): In function `boost::filesystem::directory_iterator::directory_it erator[in-charge](boost::filesystem::path const&)': : undefined reference to `boost::filesystem::detail::dir_itr_init(boost::shared_ ptr<boost::filesystem::detail::dir_itr_imp>&, boost::filesystem::path const&)' /tmp/ccP4gcx3.o(.gnu.linkonce.t._ZNK5boost10filesystem18directory_iterator11dere ferenceEv+0xd): In function `boost::filesystem::directory_iterator::dereference( ) const': : undefined reference to `boost::filesystem::detail::dir_itr_dereference(boost:: shared_ptr<boost::filesystem::detail::dir_itr_imp> const&)' /tmp/ccP4gcx3.o(.gnu.linkonce.t._ZN5boost10filesystem18directory_iterator9increm entEv+0xd): In function `boost::filesystem::directory_iterator::increment()': : undefined reference to `boost::filesystem::detail::dir_itr_increment(boost::sh ared_ptr<boost::filesystem::detail::dir_itr_imp>&)' collect2: ld returned 1 exit status

Daniel Huber wrote:
Hi,
I have done some additional testing on th eproblem that I reported yesterday, and I have found that the problem I was having with static linking under gcc 2.95.3 also occurs on gcc 3.2.2.
[snip]
g++ -L $HOME/linux/lib/boost/lib -static -lboost_filesystem -gcc -I $HOME/linux/lib/boost/include/boost-1_31 test_boost.cxx /tmp/ccP4gcx3.o(.text+0x19): In function `main': : undefined reference to `boost::filesystem::initial_path()'
Try putting -lboost_filesystem _after_ test_boost.cxx I hope this helps, Stephen Jackson
participants (2)
-
Daniel Huber
-
Stephen Jackson