文件目录结构
只为了测试将 .h
单独放在一个文件夹中。
stack.c
// ...
#include "stack.h"
//...
c_cpp_properties.json
${workspaceFolder}/include/**
试图将工作目录下的 include 文件夹包含进去,但未生效。
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/include/**"
],
"defines": [],
"macFrameworkPath": [
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64"
}
],
"version": 4
}
运行报错
mypc$ gcc stack.c -o stack
stack.c:5:10: fatal error: 'stack.h' file not found
#include "stack.h"
^~~~~~~~~
1 error generated.
请有经验的同学多多指教,谢谢!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…