Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [config] SDL1 with qtcreator
Forum Updated to NodeBB v4.3 + New Features

[config] SDL1 with qtcreator

Scheduled Pinned Locked Moved Qt Creator and other tools
1 Posts 1 Posters 774 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Phenixo
    wrote on last edited by
    #1

    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

    to be a professional programmer is my goal :p

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved