c++ - 如何使用 Visual Studio 修复 "fatal error C1083: Cannot open include file"

标签 c++ visual-c++

我在使用Eclipse后第一次安装了“MS VS VC++ 2010 Express”。我按照说明将其安装在“Setting Up GLFW in Visual Studio 2010”。

然后我写了这个程序来测试它,它在 Eclipse 中运行良好:

#include <stdlib.h>
#include <GL/glfw.h>
using namespace std;



int wmain(){

    int running = GL_TRUE;


    if (!glfwInit()){
        exit (EXIT_FAILURE);
    }


    if (!glfwOpenWindow( 300,300 ,0,0,0,0,0,0, GLFW_WINDOW)){
        glfwTerminate();
        exit(EXIT_FAILURE);
    }


    while (running) {
        glClear( GL_COLOR_BUFFER_BIT );

        glfwSwapBuffers();

        running = !glfwGetKey (GLFW_KEY_ESC) && glfwGetWindowParam (GLFW_OPENED);
    }




    glfwTerminate();

    exit(EXIT_SUCCESS);



return 0;
}

这就是它在控制台中所说的:

------ Build started: Project: first1, Configuration: Debug Win32 ------
  first.cpp
c:\users\pc\documents\visual studio 2010\projects\first1\first1\first.cpp(2): fatal error C1083: Cannot open include file: 'GL/glfw.h': No such file or directory
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

安装过程中可能存在缺陷,如果是,那可能是什么问题?

最佳答案

这些说明缺少设置您的包含路径。您需要将包含 GLFW 的所有包含文件的目录 GL 的父目录添加到 Project Properties/Configuration Properties/VC++ Directories/Include Directories项目属性/配置属性/C/C++/常规/附加包含目录

关于c++ - 如何使用 Visual Studio 修复 "fatal error C1083: Cannot open include file",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17070792/

相关文章:

c++ - 使用 gdb 进行分布式软件调试

c++ - 对存储在双端队列中的类对象进行排序

python - Pybind11:将 Python 列表传递给 C 样式数组

winapi - 如何从其句柄获取控件ID?

c++ - 我如何强制编译器生成的类的复制构造函数*不*被编译器内联?

c++ - std::chrono::system_time 的 Visual Studio 2017 CRT 实现使用什么时钟?

c++ - 排序程序的错误代码

c++ - 如何停止 for_each() 循环的迭代?对于(:) is not a viable option

c++ - cmake 生成的 makefile 错误中的奇怪字符 "â"

c++ - 使用 GDAL 和 OpenCV 编写 RGB 16 位图像