2
votes

I'm trying to use Boost.Asio on a ActiveX DLL project using Visual Studio 2013. Not sure what is wrong but when building these error shows up:

Error 34 error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "public: __thiscall boost::system::error_code::error_code(void)" (??0error_code@system@boost@@QAE@XZ) C:\eCompany\activex-dll\maindoor\RESTClient.obj maindoor Error 35 error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'errno_ecat''(void)" (??__Eerrno_ecat@system@boost@@YAXXZ) C:\Projects\eCompany\activex-dll\maindoor\RESTClient.obj maindoor Error 36 error LNK1120: 2 unresolved externals C:\Projects\eCompany\activex-dll\maindoor\Debug\maindoorEWI.dll 1 1 maindoor

I already added BOOST_ALL_NO_LIB in the Preprocessor. What could be missing in the project?

1
Looks like you're not linking to the Boost.System library (Asio has a dependency on that). Why did you add BOOST_ALL_NO_LIB? That disables auto linking. With auto linking you'd probably have been able to link successfully.Praetorian
If I remove it, this is the only error: error LNK1104: cannot open file 'libboost_system-vc120-mt-sgd-1_58.lib' not sure why its not in the C:\local\boost_1_58_0\stage\lib folderxkm
Did you build Boost? If not, open a VS2013 command prompt, and from within your Boost directory run bootstrap && b2 --build-type=complete stage. Here's the documentation.Praetorian

1 Answers

2
votes

The short answer is to do something like this:

C:\local\boost_1_58_0>bjam.exe runtime-link=static

and remove BOOST_ALL_NO_LIB is its set, then build the DLL again. That should fix that.