Pregunta

I've got a C++ project in Visual Studio 2010 where I'm porting my code from the old yaml-cpp 0.3 API to the new 0.5 API. I've set up Boost, built the new DLLs with CMake, set up the include and library paths, updated all the code to match the new API, and everything compiles fine.

However, when it reaches linking, I'm met with a barrage of linker errors like this:

error LNK2001: unresolved external symbol "public: static bool __cdecl YAML::convert<bool>::decode(class YAML::Node const &,bool &)"
error LNK2001: unresolved external symbol "private: void __thiscall YAML::detail::node_data::insert_map_pair(class YAML::detail::node &,class YAML::detail::node &)"
error LNK2001: unresolved external symbol "public: void __thiscall YAML::detail::memory_holder::merge(class YAML::detail::memory_holder &)"
error LNK2001: unresolved external symbol "public: class YAML::detail::node & __thiscall YAML::detail::memory::create_node(void)"
error LNK2001: unresolved external symbol "public: void __thiscall YAML::detail::node_data::mark_defined(void)"
error LNK2001: unresolved external symbol "public: void __thiscall YAML::detail::node_data::set_null(void)"
...

It looks like not all symbols are being exported to the DLL, but I don't know how to fix it. I've tried cleaning everything, rebuilding, Debug/Release, different VS versions, etc. With yaml-cpp 0.3 it all worked fine, but I really want the new API. These are the settings I'm using in CMake to build the library:

APPLE_UNIVERSAL_BIN = false
BUILD_SHARED_LIBS = true
MSVC_SHARED_RT = true
MSVC_STHREADED_RT = false
YAML_CPP_BUILD_CONTRIB = false
YAML_CPP_BUILD_TOOLS = false
¿Fue útil?

Solución

This is a known issue. You can follow the issue page on the project's page.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top