c++ - Can't run SDL2 project, "Cannot execute "": %1 Not a valid Win32-application" -


i'm trying teach myself how use sdl2 qt creator keep getting these "just let me code" situations. currently, i'm trying open window green picture on (doing tutorial) error:

cannot execute "": %1 not valid win32-application 

i'm using mingw 5.3.0 32bit2 compiler , i've managed run other projects without error. tried tinkering build , run configurations, haven't had luck. (essential) run configurations this:

executable c:\...\sdl_test\debug\sdl_test.exe working directory: c:\...\sdl_test 

also reference, here's main.cpp:

#include <iostream> #include <stdio.h> #include <sdl2/sdl.h> #include <sdl2/sdl_image.h>  using namespace std;    int main() {     bool quit = false;     sdl_init(sdl_init_video);     sdl_window* window = nullptr;     window = sdl_createwindow("mvp", 100, 100, 600, 400,                               sdl_window_shown);      if(window == nullptr){         cout << "window not created." << endl;         return 0;     }      sdl_renderer* renderer = nullptr;     renderer = sdl_createrenderer(window, -1,                                   sdl_renderer_accelerated);     sdl_event* mainevent = new sdl_event();      sdl_texture* grass_image = null;     grass_image = img_loadtexture(renderer, "grass.bmp");      sdl_rect grass_rect;     grass_rect.x = 10;     grass_rect.y = 50;     grass_rect.w = 250;     grass_rect.h = 250;      while(!quit && mainevent->type != sdl_quit){         sdl_pollevent(mainevent);         sdl_renderclear(renderer);          sdl_rendercopy(renderer, grass_image, null, &grass_rect);          sdl_renderpresent(renderer);     }     sdl_destroywindow(window);     sdl_destroyrenderer(renderer);     delete mainevent;      return 0;  } 

feeling hopeless, since want open window green rectangle on it... ask?!

edit: here's .pro file

template = app config += console c++11 config -= app_bundle config -= qt sources += main.cpp   win32: libs += -l$$pwd/../../../../sdl2-2.0.5/i686-w64-mingw32/lib/ -lmingw32 -lsdl2main -lsdl2  includepath += $$pwd/../../../../sdl2-2.0.5/i686-w64-mingw32/include dependpath += $$pwd/../../../../sdl2-2.0.5/i686-w64-mingw32/include  win32: libs += -l$$pwd/../../../../sdl2_image-2.0.1/i686-w64-mingw32/lib/ -lmingw32 -lsdl2_image  includepath += $$pwd/../../../../sdl2_image-2.0.1/i686-w64-mingw32/include dependpath += $$pwd/../../../../sdl2_image-2.0.1/i686-w64-mingw32/include  win32:qmake_lflags += -shared 

the code showing works linux , sane system :)

there few issues problem:

1 - trying run 64 bit application in 32 bit system

2 - dll's corrupt

3 - sdl dll's compiled microsoft visual studio (and need dll's generated mingw)

also, should pass few flags compiler, since told using qt creator, possibly have projectname.pro file or cmakelists.txt

discover have, , pass flags compiler:

-wl,-subsystem,windows

and link against libraries

-lmingw32 -lsdl2main -lsdl2


Comments