所以我在我的makefile中使用这一行在我的Mac上运行SFML:
g++ -I/Users/Junker/SFML/include -L/Users/Junker/SFML/lib main.cpp -lsfml-system -lsfml-window - lsfml-graphics -lsfml-audio
我认为在Windows机器上使用MingW时或多或少会相同,但这不起作用:
g++ -I"C:\SFML-2.1\include" -L"C:\SFML-2.1\lib" main.cpp -lsfml-graphics -lsfml-window -lsfml-system
对于Windows,我下载了GCC 4.7 TDM(SJLJ) - 64位版本
Mac版本使用.dylibs库,Windows版本使用.a。
我尝试使用的代码是:
#include <SFML/Graphics.hpp>
int main()
{
// create the window
sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
// run the program as long as the window is open
while (window.isOpen())
{
// check all the window's events that were triggered since the last iteration of the loop
sf::Event event;
while (window.pollEvent(event))
{
// "close requested" event: we close the window
if (event.type == sf::Event::Closed)
window.close();
}
// clear the window with black color
window.clear(sf::Color::Black);
// draw everything here...
// window.draw(...);
// end the current frame
window.display();
}
return 0;
}
错误测试是对VideoMode,RenderWindow和其他一些未定义的引用。是否有一个库或其中一部分没有正确链接?
我应该将哪些其他内容应用于我的编译行以使其工作?
提前感谢您的帮助!