我的代码:
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
while(window.isOpen())
{
sf::Event Event;
while(window.pollEvent(Event))
{
if(Event.type == sf::Event::Closed || Event.key.code == sf::Keyboard::Escape)
window.close();
}
window.display();
}
return 0;
}
我的编译器调用:
g++ main.cpp -framework SFML -lsfml-graphics -lsfml-window -lsfml-system
错误信息:
Undefined symbols for architecture x86_64:
"sf::RenderWindow::RenderWindow(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)", referenced from:
_main in cc8BMfpR.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
RenderWindow 是否在我忘记链接的库中?我以为它在“窗口”中。我正在运行 SFML 2.1 并尝试了各种链接组合,所有这些都给了我链接错误。这个链接链给我的错误最少,即 RenderWindow 错误。有人帮我解决这个问题吗?我在这里有点茫然。我在 mac os 10.8 上运行。