debugging 代码块:使用SDL2时出现“创建进程时出错(错误193)“

2admgd59  于 2023-01-17  发布在  其他
关注(0)|答案(1)|浏览(110)

我想调试带有代码块的代码。如果使用SDL 2库,则无法调试。
bin/debug/*.exe的构建正常...但当我运行它时,出现以下消息:

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

添加#include <SDL.h>时出现
有人有办法解决我的问题吗?因为我想使用SDL 2调试复杂的代码...
代码示例:

#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;
}

我想运行带有“#include“的调试 *.exe<SDL.h>
编辑1
生成日志为:

-------------- 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))

(我已手动将SDL2.dll复制到bin/debug中)
编译器和调试器设置为
调试器设置-〉GDB/CDB调试器-〉默认:可执行路径:C:\程序文件\代码块\MINGW\bin\gdb.exe
编译器设置-〉调试器:GDB/CDB调试器:默认值

dddzy1tm

dddzy1tm1#

看看其他论坛,问题就解决了:我在“#include“后面添加了“#undef main”<SDL.h>

相关问题