Archived

This forum has been archived. Please start a new discussion on GitHub.

Linking a new library into IcePatch2

Hello, I want to extend the code of the Server of IcePatch2. I want to use the boost library for that purpose. So I added
#include "boost/filesystem/operations.hpp" to the include instructions of the file Server.cpp. Then I have written my code using the functionality of boost. The problem is now that the boost library is not linked when I execute "make". I got the following error message:
../../lib/libIcePatch2.so: undefined reference to `boost::filesystem::path::path[in-charge](std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: ld returned 1 exit status

So I have to modify the Makefile somewhere apparently. But where?

Comments

  • Adding the boost library to the LINKWITH line in the IcePatch2 Makefile should work.
  • Answer

    Ah, I just found an option by myself. I added -lboost_filesystem to the $(SERVER) target so it looks now

    $(SERVER): $(SOBJS) $(LIBTARGETS)

    $(CXX) $(LDFLAGS) -lboost_filesystem -o $@ $(SOBJS) $(OPENSSL_RPATH_LINK) -lIcePatch2 $(LIBS)

    and it works. I tried to add -lboost_filesystem to the LINKWITH line before, but it didn't work out for some reason.
  • Ah of course, you're right. More coffee required this morning ;) LINKWITH is for the shared library, not the server.