一、原因可能是:多个源文件(.c 或 .cpp)文件,没有编译为 .o文件
处理办法:设置源文件参与编译
1、在tasks.jason 中设置源文件及参数
2、在c_cpp_properties.json 中设置头文件位置
{
"configurations": [
{
"name": "Win32",
"includePath": [
"D:/kkjson/*", //此处是需要的头文件目录位置,有多处则设置多条
"${workspaceFolder}/**"
],
"defines": ["_DEBUG", "UNICODE", "_UNICODE"],
"compilerPath": "D:\\mingw64\\bin\\gcc.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "msvc-x86"
}
],
"version": 4
}
二、静态库未引入
1、在命令行参数位置,加入静态库
如:tasks.json文件中添加
"version": "2.0.0"
"tasks":[
{
.....
"args":[
"-g",
"${workspaceFolder}/*.c",
"${workspaceFolder}/*.a",
.....
]
......
}
]
划重点:"${workspaceFolder}/*.a"
关于静态库的引用,可以参考gcc或g++命令,"args"就是命令参数