您的位置:首页 > 其它

VS2008无法打开gl/glaux.h头文件的解决方法

2014-01-05 18:19 615 查看
不知道为什么到VS2008后,SDK中没有OpenGL的头文件了,下面针对这个问题总结一下。

 

在学习NeHe的纹理映射的Lesson 6中,开始需要用到包含gl/glaux.h的头文件,但是发现在我的系统中并没有这个头文件。并发现编译器中引用OpenGL的头文件路径有两个:

C:/Program Files/Microsoft SDKs/Windows/v6.0A/include/gl/gl.h            (默认的)

C:/Program Files/Microsoft Visual Studio 9.0/VC/include/gl/glut.h           (自己手动新建的GL文件夹)

在网上google了一下解决办法。

方法1:找到用的最多的解决方法,但是我的系统中没有事先安装VS2003或VS2005,因此无法拷贝。

I have been porting old openGL program to VS2008. I have solved the problem by copying the "include/gl/glaux.h" and "lib/glaux.lib" from the VS2005 Platform SDK located on "C:/Program Files/Microsoft Visual Studio 8/VC/PlatformSDK" to the Platform SDK of VS2008
located on "C:/Program Files/Microsoft SDKs/Windows/v6.0A"

方法2:网页没打开,做个标记。

Based on the reply to https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1065518&SiteID=1, it looks like
glaux.lib is deprecated. Instead link to kernel32.lib, user32.lib, gdi32.lib and advapi32.lib

方法3:直接使用glut工具包,我在VS2008上试了一下不行,报同样的错误。

The easiest way to sort this out is to:

1) install glut 3.6 or newer as directed.

2) Open Visual studio 2008 and create a new project

3) choose c++ - empty solution

4) import all the files from your previous OpenGL project

5) delete all headers i.e.

#include <gl/glu.h>

#include <gl/gluax.h>

and any other GL headers

6) then replace with #include <gl/glut.h>

7) recompile.

this worked for all of my 2003 & 2005 solutions.

方法4:下载缺少的文件。

下载源1:CSDN下载

OpenGL 安装包所需文件下载:
http://d.download.csdn.net/down/2560229/ssagnn23

包括:

GL.H   GLAUX.H   GLU.H   glut.h   

GLAUX.LIB   GLU32.LIB   glut32.lib   glut.lib   OPENGL32.LIB 

glaux.dll   glu32.dll   glut32.dll   glut.dll   opengl32.dll 

VS2008不带 GL.H, GLAUX.h, glu.h, glaux.lib, glu32.lib, opengl32.lib 这些文件。通过上面所给地址下载后,把下载的文件分配放在系统中不同的文件夹下,具体配置方法如下:

(1) 把 glaux.dll、glut32.dll、glut.dll 拷贝到C:/WINDOWS/system32目录下,system32目录下应该已经有 opengl32.dll、glu32.dll了。 

(2) 把 GL.H、GLAUX.h、glu.h、glut.h  拷贝到 C:/Program Files/Microsoft Visual Studio 9.0/VC/include/gl 

(3) 把 GLAUX.LIB、Glu32.lib、glut32.lib、Opengl32.lib,glut.lib 拷贝到 C:/Program Files/Microsoft Visual Studio 9.0/VC/lib 

下载源2:

nehe-src-cn —— Nehe的OpenGL教程中文版及代码下载 
http://code.google.com/p/nehe-src-cn/downloads/list 

Nehe的OpenGL教程中文版及代码下载
http://www.yakergong.com/nehe/

提供了每个Lesson的示例代码以及所需要的文件。

按照方法4,下载完文件并配置后好,重新编译,以前的错误没有了,说明文件找到了,但又出现下面这个错误。

error C2664: “auxDIBImageLoadW”: 不能将参数 1 从“char *”转换为“LPCWSTR”

这个是因为我建立的是基于unicode字符集的工程,所以要使用宽字符。也可以不使用unicode字符集,在属性页->配置属性->常规里修改即可。此处选择不使用unicode字符集,即,选择未设置。然后再重新编译,ok!

注意:Debug版本和Release版本要分别设置字符集。

参考

missing glaux.h in v6.0a sdk?
http://social.msdn.microsoft.com/Forums/en/windowssdk/thread/b66e5f7a-91f6-4dbe-b388-0c131008b08f

VS2003下的项目在VS2008下编译不过,找不到gl/glaux.h
http://topic.csdn.net/u/20070930/15/6a900f21-8e41-4325-862f-f6df3a425f36.html

VS 2008 OpenGL 配置
http://lujun5918.blog.163.com/blog/static/287227712011013114410553/

opengl中载入图片生成纹理的程序
http://topic.csdn.net/u/20070823/19/4497cb18-be2a-464f-ad20-b12191a61b26.html

转载自:http://blog.csdn.net/delphiwcdj/article/details/6326586
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: