开发者

Getting SFML working in QT

开发者 https://www.devze.com 2023-04-01 12:44 出处:网络
Just trying to figure out how to get SFML to work in QT. My include path in the .pro file looks as follows:

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
0

精彩评论

暂无评论...
验证码 换一张
取 消