Ash*_*ppa 10 opengl glut visual-studio visual-c++
在Visual C++ Express Edition下使用GLUT(OpenGL Utility Toolkit)编译OpenGL应用程序的基本步骤是什么?
您使用GLUT或OpenGL的程序现在应该在Visual C++ Express Edition下编译.
Nate Robin网站上的GLUT端口是从2001年开始的,与Visual Studio的版本(.NET 2003及更高版本)有一些不兼容的地方.不相容性表现为重新定义的错误exit().如果您看到此错误,则有两种可能的解决方案:
exit()原型glut.h与一个在你stdlib.h让它们匹配.这可能是最好的解决方案.#define GLUT_DISABLE_ATEXIT_HACK之前#include <gl/glut.h>.(应有的信誉:我最初在TAMU服务台网站上看到了这个建议.)
自.NET 2003问世以来,我一直在使用方法#1,并且使用了glut.h与VC++ 2003,VC++ 2005和VC++ 2008 相同的修改方法.
这里是glut.h的差异,我使用的是#1(但在适当的#ifdef blocks情况下它仍适用于旧版本的Visual Studio):
--- c:\naterobbins\glut.h 2000-12-13 00:22:52.000000000 +0900
+++ c:\updated\glut.h 2006-05-23 11:06:10.000000000 +0900
@@ -143,7 +143,12 @@
#if defined(_WIN32)
# ifndef GLUT_BUILDING_LIB
-extern _CRTIMP void __cdecl exit(int);
+/* extern _CRTIMP void __cdecl exit(int); /* Changed for .NET */
+# if _MSC_VER >= 1200
+extern _CRTIMP __declspec(noreturn) void __cdecl exit(int);
+# else
+extern _CRTIMP void __cdecl exit(int);
+# endif
# endif
#else
/* non-Win32 case. */
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16410 次 |
| 最近记录: |