Visual Studio SFML Linker Error [duplicate]

僤鯓⒐⒋嵵緔 提交于 2019-12-08 10:45:12

问题


I am new to SFML and when I tried to compile a basic program, I'd get this error

Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) void >__cdecl sf::sleep(class sf::Time)" (__imp_?sleep@sf@@YAXVTime@1@@Z) referenced in> >function _main C:\Users\asd\documents\visual studio 2013\Projects\OpenGL\OpenGL\Source.obj OpenGL

Here's the code:

#include <SFML/System.hpp>
#define SFML_STATIC

int main()
{
  sf::sleep(sf::seconds(1.f));
  return 0;
}

I also linked the sfml-windows-s.lib and sfml-system-s.lib


回答1:


I had to define SFML_STATIC as a preprocessor instead of inside the code.



来源:https://stackoverflow.com/questions/30015154/visual-studio-sfml-linker-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!