'"unresolved external symbol __declspec(dllimport)" error when using yaml-cpp in Visual Studio 2017 [duplicate]

I compiled yaml-cpp as a static library using Visual Studio Community 2013 and added the library to my project.

Here is my code:

YAML::Node node = YAML::Load("{name: BS, city: KORE}");
std::cout << node.size();

this code causes these errors:

1>Test.obj : error LNK2019: symbole externe non résolu "__declspec(dllimport) public: __cdecl YAML::Node::~Node(void)" (__imp_??1Node@YAML@@QEAA@XZ) référencé dans la fonction "private: void __cdecl Test::call(void)" (?call@Test@@AEAAXXZ)
1>Test.obj : error LNK2019: symbole externe non résolu "__declspec(dllimport) public: unsigned __int64 __cdecl YAML::Node::size(void)const " (__imp_?size@Node@YAML@@QEBA_KXZ) référencé dans la fonction "private: void __cdecl Test::call(void)" (?call@Test@@AEAAXXZ)
1>Test.obj : error LNK2019: symbole externe non résolu "__declspec(dllimport) class YAML::Node __cdecl YAML::Load(char const *)" (__imp_?Load@YAML@@YA?AVNode@1@PEBD@Z) référencé dans la fonction "private: void __cdecl Test::call(void)" (?call@Test@@AEAAXXZ)

knowing that I added in Linker input yaml-cppd.lib and the path of .lib in additional library directories.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source