在过去的两周里,我一直在尝试使用 SFML 设置 qt creator,但无济于事......这是我的 .pro 文件:
TEMPLATE = app
CONFIG += console
CONFIG -= qt
SOURCES += main.cpp
INCLUDEPATH += C:\SFML\include
LIBS += C:\SFML\lib\libsfml-system.a \
C:\SFML\lib\libsfml-window.a \
C:\SFML\lib\libsfml-graphics.a \
C:\SFML\lib\libsfml-audio.a \
C:\SFML\lib\libsfml-network.a
我的代码:
#include <SFML/System.hpp>
#include <iostream>
int main()
{
sf::Clock Clock;
while (Clock.GetElapsedTime() < 5.f)
{
std::cout << Clock.GetElapsedTime() << std::endl;
sf::Sleep(0.5f);
}
return 0;
}
但我收到这些错误:
main.obj:-1: error: LNK2019: unresolved external symbol "void __cdecl sf::Sleep(float)" (?Sleep@sf@@YAXM@Z) referenced in function _main
main.obj:-1: error: LNK2019: unresolved external symbol "public: float __thiscall sf::Clock::GetElapsedTime(void)const " (?GetElapsedTime@Clock@sf@@QBEMXZ) referenced in function _main
debug\SfmlLearning.exe:-1: error: LNK1120: 3 unresolved externals
debug\SfmlLearning.exe:-1: error: LNK1120: 3 unresolved externals
知道是什么原因造成的吗?