samedi 28 octobre 2017

boost::process throws LNK2019: unresolved external symbol

I've installed Boost using vcpkg. Now I'm trying a "Hello World" with Boost:process. Suppose I start with Boost commented out everything works fine

#include <iostream>
//#include <boost/process.hpp>
//#include <boost/process/windows.hpp>

//namespace bp = boost::process;
int main(int argc, char * argv[])
{
    int result = std::system("echo Hello");
}

Now if I uncomment Boost but don't use it i.e. I still call

std::system("echo Hello"); 

it compiles but throws two link errors

"__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::system_category(void)" (__imp_?system_category@system@boost@@YAABVerror_category@12@XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??__Enative_ecat@system@boost@@YAXXZ)
"__declspec(dllimport) class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (__imp_?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)

I've tried adding Additional Library Dependencies for

C:\vcpkg-master\installed\x86-windows\lib
C:\vcpkg-master\packages\boost_x86-windows\debug\bin
C:\vcpkg-master\packages\boost_x86-windows\debug\lib
C:\vcpkg-master\packages\boost_x86-windows\lib
C:\vcpkg-master\packages\boost_x86-windows\bin

but none of those resolve the error. Does anyone know where to find the correct link librries?

If I actually call Boost with int result = bp::system("echo Hello"); there are 9 unresolved externals.

Aucun commentaire:

Enregistrer un commentaire