jbeder / yaml-cpp

A YAML parser and emitter in C++
MIT License
5.09k stars 1.83k forks source link

Linking yaml-cpp in project without CMAKE in 32 bit mode #1161

Closed Aenge closed 1 year ago

Aenge commented 1 year ago

My project is a windows only project, so it doesn't use CMAKE. It also is a 32 bit application. I built yaml-cpp using cmake -A Win32, which sucessfully built, but still isn't linking properly. -A x86 didn't build at all. I know my project is linking the .lib correctly. The code I'm using is simple:

#include "RuntimeConfig.h"
#include "yaml-cpp/yaml.h"

int RuntimeConfig::Initialize()
{

    YAML::Node config = YAML::LoadFile("config.yaml");

    return 1;
}

Which results in LNK2001's:

Severity    Code    Description Project File    Line    Suppression State
Error   LNK2001 unresolved external symbol "__declspec(dllimport) class YAML::Node __cdecl YAML::LoadFile(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?LoadFile@YAML@@YA?AVNode@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)  1   
Error   LNK2001 unresolved external symbol "__declspec(dllimport) public: __thiscall YAML::Node::~Node(void)" (__imp_??1Node@YAML@@QAE@XZ)  1   

I've tried debug and release mode but I can't get it to work. What am I missing here?

jbeder commented 1 year ago

I don't know; you'll probably get more responses if you ask on Stack Overflow. If you find a bug (or especially if you have a PR), please submit it.