Visual Studio SFML链接器错误 [英] Visual Studio SFML Linker Error
问题描述
我是SFML的新手,当我尝试编译基本程序时,会出现此错误
I am new to SFML and when I tried to compile a basic program, I'd get this error
错误2错误LNK2019:未解决的外部符号"__declspec(dllimport)无效> __ cdecl sf :: sleep(class sf :: Time)"(__imp_?sleep @ sf @@ YAXVTime @ 1 @@ Z)在>>中引用函数_main C:\ Users \ asd \ documents \ Visual Studio 2013 \ Projects \ OpenGL \ OpenGL \ Source.obj OpenGL
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
这是代码:
#include <SFML/System.hpp>
#define SFML_STATIC
int main()
{
sf::sleep(sf::seconds(1.f));
return 0;
}
我还链接了sfml-windows-s.lib和sfml-system-s.lib
I also linked the sfml-windows-s.lib and sfml-system-s.lib
推荐答案
我不得不将SFML_STATIC定义为预处理器,而不是在代码内部.
I had to define SFML_STATIC as a preprocessor instead of inside the code.
这篇关于Visual Studio SFML链接器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!