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 SDL 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
my file *.pro
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
LIBS += -L C:/Qt/Tools/SDL/SDL1/lib -lmingw32 -lSDLmain -lSDL -mwindows
INCLUDEPATH += C:/Qt/Tools/SDL/SDL1/include/
SOURCES += main.cpp
include(deployment.pri)
qtcAddDeployment()
my main.cpp
#include <stdlib.h>
#include <stdio.h>
#include <SDL/SDL.h>
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;
}
}
}
I have this error
C:\Users\Phenix\Documents\c++ project\td7\test3\main.cpp:7: avertissement : unused parameter 'argc' [-Wunused-parameter] int main(int argc, char *argv[])
C:\Users\Phenix\Documents\c++ project\td7\test3\main.cpp:7: avertissement : unused parameter 'argv' [-Wunused-parameter] int main(int argc, char *argv[])
crt0_c.c:-1: erreur : undefined reference to `WinMain@16'
collect2.exe:-1: erreur : error: ld returned 1 exit status
And This is my SDL1 directory there is more file in the end of the directory but I think they are not important
Test
Share
Man
Lib
Include
Docs
Build-scripts
bin
Thanks a lot for helping me
I have found a solution this is my finale *.pro file
I didn't add the SDL.dll file in to SysWOW64. you have to add if the compilation showing no error but the window doesn’t open.