提示:这里简述项目相关背景:
问题一:提示undefined reference to `_Unwind_Resume’等
解决方法:
在graphics.h的头文件中添加三行代码:
void * __gxx_personality_v0 = 0;
void * _Unwind_Resume = 0;
void * __gxx_personality_seh0 = 0;
二、问题二:
undefined reference to initgraph(int, int, int)' undefined reference to
circle(int, int, int)’
需要在tasks.json中。添加四行代码
"-L",
"${fileDirname}\\EasyX",
"-leasyx",
"-lstdc++"
三、已配置好的vscode工程:
c_cpp_properties.json
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.22000.0",
"compilerPath": "D:/Softeware/mingw64/bin/g++.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64"
}
],
"version": 4
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++.exe build active file",
"command": "D:/Softeware/mingw64/bin/g++.exe",
"args": [
"-fdiagnostics-color=always",
"-g",
"${workspaceFolder}\\src\\*.cpp",
"-o",
"${workspaceFolder}\\output\\main_cpp.exe",
"-I",
"${workspaceFolder}\\include\\",
"-L",
"${fileDirname}\\EasyX",
"-leasyx",
"-lstdc++"
],
"options": {
"cwd": "D:/Softeware/mingw64/bin"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: D:/Softeware/mingw64/bin/g++.exe"
}
]
}