首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >致命错误: GLFW/glfw3.h:没有此类文件或目录

致命错误: GLFW/glfw3.h:没有此类文件或目录
EN

Stack Overflow用户
提问于 2021-10-07 09:56:16
回答 1查看 420关注 0票数 0

当我试图导入GLFW时,我在VSCode中得到一个错误,上面写着“致命错误: GLFW/glfw3.h:没有这样的文件或目录”。我读了一些关于这个错误的文章,但不明白如何解决这个问题。谢谢你的帮助!

项目结构:

代码语言:javascript
复制
src/
   main.c
lib/
   GLFW/
       include/
              GLFW/
                  glfw3.h
       glfw3.lib

以下是我的主要代码:

代码语言:javascript
复制
#include <stdio.h>
#include <GLFW/glfw3.h> // fatal error: GLFW/glfw3.h: No such file or directory

int main() {
    printf("Hello, World!");

    return 0;
}

c_cpp_properties.json:

代码语言:javascript
复制
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}\\src\\**",
                "${workspaceFolder}\\lib\\**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.19041.0",
            "compilerPath": "C:\\MinGW\\bin\\gcc.exe",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-gcc-x64"
        }
    ],
    "version": 4
}

tasks.json

代码语言:javascript
复制
{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: gcc.exe build active file",
            "command": "C:\\MinGW\\bin\\gcc.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "compiler: C:\\MinGW\\bin\\gcc.exe"
        }
    ]
}
EN

回答 1

Stack Overflow用户

发布于 2022-04-18 08:48:39

c_cpp_properties.json

代码语言:javascript
复制
    "forcedInclude": [
        "C:/VulkanSDK/1.3.204.1/Include/vulkan/vulkan.h",
        "C:/glfw-3.3.6.bin.WIN64/include/GLFW/glfw3.h"
    ]


    "includePath": [
        "${workspaceFolder}/include",
        "C:/VulkanSDK/1.3.204.1/Include/**",
        "C:/glfw-3.3.6.bin.WIN64/include/**",
        "C:/glm"
    ]
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69479131

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档