起因:我需要用到比如32bit的time_t而不是64bit的time_t,因为我测试的目标程序最终运行在32bit的环境中。
可以通过tasks.json, 设置"args", "-m32"来实现。如下例子所示
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: gcc.exe build active file",
"command": "c:\\mingw64\\bin\\gcc.exe",
"args": [
"-m32"
"-fdiagnostics-color=always",
"-g",
"D:\\TEST\\*.c",
"-o",
"D:\\TEST\\HelloWorld.exe"
],
"options": {
"cwd": "c:\\mingw64\\bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
问题:
虽然mingw64可以成功编译32位的程序,但是不能debug 32位的程序(不进断点),临时解决方案是下载了mingw32来进行编译和debug 32位的程序。