I built yaml-cpp staticly using vs2019 and got lib from path yaml-cpp-master\build\Release\yaml-cpp.lib
, now I intend to add it to my own project, simple code follows:
#include <yaml-cpp/yaml.h>
#include <string>
using namespace std;
int main() {
YAML::Node config = YAML::LoadFile("test.yaml");
if (config["test1"]) {
cout << config["test1"].as<string>() << endl;
}
return 0;
}
I've set my project properties following How to add static libraries to a Visual studio project, but I meet LNK2001 error and C4251 warning when building:
LNK2001 "__declspec(dllimport) public: __cdecl YAML::Node::Node(void)" (__imp_??0Node@YAML@@QEAA@XZ)
it seems the linker still wants dll...which is not my intention, is there any possible solutions?