Getting SFML working in QT
Just trying to figure out how to get SFML to work in QT. My include path in the .pro file looks as follows:
#include sfml
INCL开发者_开发技巧UDEPATH += /usr/include/SFML
while my main file has....
#include "mainwindow.h"
#include <QtGui/QApplication>
#include <iostream>
#include <SFML/System.hpp>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow mainWindow;
mainWindow.setOrientation(MainWindow::ScreenOrientationAuto);
mainWindow.showExpanded();
sf::Clock Clock;
while (Clock.GetElapsedTime() < 5.f)
{
std::cout << Clock.GetElapsedTime() << std::endl;
sf::Sleep(0.5f);
}
return app.exec();
}
Yet, all I get is a bunch of undefined references. Why is this?q
INCLUDEPATH
allow the compiler to find the headers, you need to add the following line to you .pro file to link the library
LIBS += -lsfml-system -lsfml-window -lsfml-graphics -lsfml-audio
精彩评论