zeboidlund
zeboidlund

Reputation: 10137

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
INCLUDEPATH += /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

Upvotes: 1

Views: 1681

Answers (1)

alexisdm
alexisdm

Reputation: 29886

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

Upvotes: 1

Related Questions