I want to debug a code with codeblocks. It is not possible if I use the SDL2 lib.
The building of the bin/debug/*.exe is ok...but when I run it there is the following message:
Starting debugger: gdb.exe -nx -fullname -quiet -args .../bin/Debug/dsl2_test4.exe
done
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 8.1
Error creating process ...\bin\Debug\dsl2_test4.exe, (error 193).
Debugger finished with status 0
It appears when I add #include <SDL.h>
Has someone an idea to solve my problem because I would like to debug complex code using SDL2...
example of code:
#include <exception>
#include <string>
#include <iostream>
#include <stdlib.h>
#include <SDL.h>
int main(int argc, char* argv[])
{
int a;
int b = 5;
a = b+6;
return 0;
}
I want to run a debug *.exe with "#include <SDL.h>"
edit 1
build log is:
-------------- Clean: Debug in dsl2_test4 (compiler: GNU GCC Compiler)---------------
Cleaned "dsl2_test4 - Debug"
-------------- Build: Debug in dsl2_test4 (compiler: GNU GCC Compiler)---------------
g++.exe -Wall -g -I..\SDL2\SDL2-devel-2.24.0-mingw\SDL2-2.24.0\x86_64-w64-mingw32\include\SDL2 -c ...\dsl2_test4\main.cpp -o obj\Debug\main.o
g++.exe -LC:\SDL2\SDL2-devel-2.24.0-mingw\SDL2-2.24.0\x86_64-w64-mingw32\lib -o bin\Debug\dsl2_test4.exe obj\Debug\main.o -lmingw32 -lSDL2main -lSDL2.dll -luser32 -lgdi32 -lwinmm -ldxguid
\dsl2_test4\main.cpp: In function 'int SDL_main(int, char**)':
\dsl2_test4\main.cpp:11:9: warning: variable 'a' set but not used [-Wunused-but-set-variable]
int a;
^
Output file is bin\Debug\dsl2_test4.exe with size 85.52 KB
Running project post-build steps
XCOPY ...\SDL2\SDL2-devel-2.24.0-mingw\SDL2-2.24.0\x86_64-w64-mingw32\bin\*.dll bin\Debug\ /D /Y
0 fichier(s) copi‚(s)
Process terminated with status 0 (0 minute(s), 1 second(s))
0 error(s), 1 warning(s) (0 minute(s), 1 second(s))
(I have manually copied SDL2.dll in bin/debug)
Compiler and Debugger settings are
Debugger settings -> GDB/CDB debugger -> Default: excutable path: C:\Program Files\CodeBlocks\MINGW\bin\gdb.exe
Compiler settings ->Debugger: GDB/CDB debugger: Default
looking at other forums, the problem is solved: I add "#undef main" after "#include <SDL.h>"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.