1
votes

I get a link error when I include the boost/log header into source file.

Error 5 error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAAEBVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??__Enative_ecat@system@boost@@YAXXZ) C:\Users\lukas\Documents\Visual Studio 2013\Projects\MyFilter\MyFilter\MyFilter.obj MyFilter

So there seems to be the problem that i didn't link the system library. However i set the link library include path to include the boost library. The file is

libboost_system-vc120-mt-1_55.lib

and is in D:\Program Files (x86)\boost_1_55_0\stage\lib - so that should work.

So why doesn't Visual Studio link it to the application? Or are there actually several boost system lib files It should have had compiled?

1
Did you add the path to Additional Library Directories? Are the libraries in the correct version? x86 to x86 project?Andre Hofmeister
yes i did. I can actually build the application when I only use the trivial.hpp file of the log libraries. But the other ones don't work because they depend on the system libaryLuke
Also the versions are correct? What target are you using? Any CPU?Andre Hofmeister
i run a 64 bit machine, but i am not actually sure if boost compiled to x64Luke
If the paths are correct, I really belive it is a version problem. To compile the different libraries use (x86) b2 --toolset=msvc-10.0 --build-type=complete stage ; (x64) b2 --toolset=msvc-10.0 --build-type=complete architecture=x86 address-model=64 stage. I hope u get ahead.Andre Hofmeister

1 Answers

1
votes

Like we discussed in the comments. Verify the version (x86 and x64) of the boost library and you're visual studio project, those version should be equal.

Here are the commands to compile boost:

x86:

b2 --toolset=msvc-10.0 --build-type=complete stage

x64:

b2 --toolset=msvc-10.0 --build-type=complete architecture=x86 address-model=64 stage