vscode 老是找不到头文件。
#include "cJSON.h"
task.json如下
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "gcc",
"args": [
"-g",
"${file}",
"-o",
"${fileBasenameNoExtension}.exe",
"-I",
"F:\\vscodDemo\\incl",
"-fexec-charset=GBK"//解决中文乱码
]
}
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
}
}
c_cpp_properties.json如下:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceRoot}",
"C:\\Program Files\\mingw64",
"F:\\vscodDemo\\incl\\"
],
"defines": [
"_DEBUG",
"UNICODE",
"__GNUC__=6",
"__cdecl=__attribute__((__cdecl__))"
],
"intelliSenseMode": "windows-gcc-x64",
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "",
"path": [
"${workspaceRoot}",
"C:\\Program Files\\mingw64"
]
}
}
],
"version": 4
}
头文件放在 F:\vscodDemo\incl
编译时候
cd "f:\vscodDemo\Cdemo_MD5" ; if ($?) { gcc Cdemo1.c -o Cdemo1 } ; if ($?) { .\Cdemo1 }
报错如下 C:\Users\ADMINI~1\AppData\Local\Temp\cc8WJLHx.o:Cdemo1.c:(.text+0x4a): undefined reference to `cJSON_Parse'
网上的方法都试过了,还是不行
报错是Cdemo1.c文件里面cJSON_Parse没定义
你放的代码哪一句跟这个有关系?
检查下所示的文件名,是否存在,路径在哪里