C++ “解决”;致命错误:GLFW/glfw3.h:没有这样的文件或目录";使用mingW g++;
当我试图编译以下简单代码时,我收到错误“致命错误:GLFW/glfw3.h:没有这样的文件或目录”:C++ “解决”;致命错误:GLFW/glfw3.h:没有这样的文件或目录";使用mingW g++;,c++,visual-studio-code,mingw,C++,Visual Studio Code,Mingw,当我试图编译以下简单代码时,我收到错误“致命错误:GLFW/glfw3.h:没有这样的文件或目录”: #include <GLFW/glfw3.h> int main() { } c_cpp_propreties.json: { "configurations": [ { "name": "Win32", "includePath": [
#include <GLFW/glfw3.h>
int main()
{
}
c_cpp_propreties.json:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"/VulkanSDK/1.2.154.1/Include/**",
"/Projects/Libraries/glm/**",
"/Projects/Libraries/glfw-3.3.2/include/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
"compilerPath": "C:\\Mingw\\mingw32\\bin\\gcc.exe",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64"
}
],
"version": 4
}
tasks.json:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"type": "shell",
"command": "g++",
"args": [
"-o",
"main",
"-g",
"main.cpp"
],
"group": {"kind": "build", "isDefault": true}
}
]
}
您是如何编译代码的?请提供一个“我编辑了我的问题”。您已经添加了两次
launch.json
,您的编译器命令可能在任务中。json
您需要在任务中指定您的包含项。json
,c_cpp_propreties.json
仅控制IntelliSense编辑了我的问题。
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"type": "shell",
"command": "g++",
"args": [
"-o",
"main",
"-g",
"main.cpp"
],
"group": {"kind": "build", "isDefault": true}
}
]
}