【问题标题】:C++ project build, but IDE shows errorC++ 项目构建,但 IDE 显示错误
【发布时间】:2014-06-17 13:30:33
【问题描述】:

Error: cannot open source file "GL/glew.h"

我有以下代码:

//Include GLEW  
#include <GL/glew.h>  

//Include GLFW  
#include <GLFW/glfw3.h>  

//Include the standard C++ headers  
#include <stdio.h>  
#include <stdlib.h>  

//Define an error callback  
static void error_callback(int error, const char* description)
{
...

我从那里获取:http://www.41post.com/5178/programming/opengl-configuring-glfw-and-glew-in-visual-cplusplus-express#part4

为了有一个可移植的解决方案,在我启动 Visual Studio 2013 之前,我在 windows 中创建了两个系统环境变量。

GLEW=C:\Install\Development\C++\Framework\glew-1.10.0-win32\glew-1.10.0 GLFW=C:\Install\Development\C++\Framework\glfw-3.0.4.bin.WIN32\glfw-3.0.4.bin.WIN32

所以在我的项目中,例如我可以编写一个额外的包含文件夹:%GLEW%\include

正如我所说,它构建良好并且运行良好。

然而,智能感知行为不正常确实很烦人。 如何解决?

【问题讨论】:

  • 什么...是......IDE...错误?请使用该信息编辑您的帖子。
  • 对,我最终忘记了主要信息......
  • 您可能想要创建项目变量而不是环境变量,例如stackoverflow.com/questions/4249844/…

标签: c++ visual-studio-2013 intellisense glew


【解决方案1】:

我的语法实际上是错误的,你不能在 VS 中使用 %% 来使用全局环境变量,但你必须使用 $(%)。

无论我在哪里写%GLEW%\include,我都应该有$(GLEW)\include

现在一切正常。

虽然我完全不知道为什么会这样。

这篇文章:https://stackoverflow.com/a/11543754/910813 让我提醒了这一点。

【讨论】:

    猜你喜欢
    • 2017-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-09
    • 1970-01-01
    • 2017-11-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多