[config] SDL1 with qtcreator



  • Hi everyone

    I have used qtcreator for console application. Now I want to use it with SDL1 because I have a tutorial on SDL1 and I want to learn it on qtcreator but it seems that qtcreator have 2 option first consol application second the interface and window application using qt. So Can I use the window generated with SDL. I did same research and I have add the SDL library to qmake but it didn’t work
    this is my *.pro file
    @QT -= core gui

    TARGET = qtsdl
    CONFIG += console
    CONFIG -= app_bundle
    CONFIG+= windows
    QMAKE_LFLAGS +=$$QMAKE_LFLAGS_WINDOWS

    LIBS += -L C:/Qt/Tools/SDL/SDL1/lib -lSDL -lSDLmain
    INCLUDEPATH += C:/Qt/Tools/SDL/SDL1/include/

    SOURCES += main.cpp
    win32:QMAKE_LIBS_QT_ENGTRY -= -lqtmain
    win32-g++:DEFINES -=QT_NEEDS_QMAIN

    QMAKE_LFLAGS += -lmingw32 -lSDLmain -lSDL -mwindows
    QMAKE_LINK +=-lmingw32 -lSDLmain -lSDL -mwindows

    @

    my main.cpp file
    @#include <stdlib.h>
    #include <stdio.h>
    #include <SDL/SDL.h>
    #define main SDL_main
    void pause();

    int main(int argc, char *argv[])
    {
    SDL_Init(SDL_INIT_VIDEO); // Initialisation de la SDL

    SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE); // Ouverture de la fenêtre
    
    pause(); // Mise en pause du programme
    
    SDL_Quit(); // Arrêt de la SDL
    
    return EXIT_SUCCESS; // Fermeture du programme
    

    }

    void pause()
    {
    int continuer = 1;
    SDL_Event event;

    while (continuer)
    {
        SDL_WaitEvent(&event);
        switch(event.type)
        {
            case SDL_QUIT:
                continuer = 0;
        }
    }@
    

    The problem is when I run this, a console application is open and there is no SDL gui (window).
    it is my first running a library from outside qt creator
    Thanks a lot for helping me


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.