Need help linking compiled boost libraries in a project

Hello, I've successfully compiled boost libraries under Windows using MinGW. I'll be using the static multithreaded libraries with Codeblocks.

So far I've done what has been suggested:
-Added boostroot/stage/lib to the linker search directory.
-Added boostroot to the header compiler search directory.
-Added "libboost_system-mgw47-mt-s-1_54.a" to the library linker settings.

It finds the compiled library and the header file otherwise it would throw an error with the code below which just uses a class defined in this library.

1
2
3
4
5
6
7
8
9
#include <boost/filesystem.hpp>

using namespace boost::filesystem;

int main()
{
  path p("abc");
  return 0;
}


Unfortunately these errors are thrown at me during compilation:
obj\Release\main.o:main.cpp: ... ||undefined reference to `boost::filesystem::path::codecvt()'|

obj\Release\main.o:main.cpp: ... ||undefined reference to `boost::filesystem::path_traits::convert(char const*, char const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, int> const&)'|


I've searched this issue for quite a bit, with no resolve. Thanks.
Found `path_traits::convert' in `libboost_filesystem.so'
However, when trying to build your code it gives me
/tmp/ccc5nHg9.o: In function `__static_initialization_and_destruction_0(int, int)':
undefined reference to `boost::system::generic_category()'
that's in `libboost_system.so'

Show your build command
Last edited on
It's generated by Codeblocks:
mingw32-g++.exe -Wall -fexceptions -std=c++11 -DBOOST_NO_CXX11_SCOPED_ENUMS -I..\include -I..\include\boost_1_54_0 -c D:\Projects\filesplitter\main.cpp -o obj\Release\main.o
mingw32-g++.exe -L..\include\boost_1_54_0\stage\lib -o "bin\Release\File Splitter.exe" obj\Release\main.o ..\include\boost_1_54_0\stage\lib\libboost_system-mgw47-mt-s-1_54.a -llboost_filesystem_mt


I believe it's happening because it didn't compile the filesystem library for some reason, I'm going to compile boost a few times with different settings.

"b2 mingw toolset=gcc" trying now.

[Edit]
Cool so that compiled the filesystem library, hopefully it'll work now.
Last edited on
Oh, it worked. Silly me. I think when you tried it under Linux, it requires some additional library to download. :D
Topic archived. No new replies allowed.