C++ 如何在 64 位 Windows 7 上为 MS VS2010 安装 GLUT?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9234664/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to install GLUT on a 64 bit windows 7 for MS VS2010?
提问by Donnovan
Can someone help me with a step by step tutorial on how to install GLUT on a Windows 7 64 bit system for MS VS2010?
有人可以帮助我提供有关如何在 Windows 7 64 位系统上为 MS VS2010 安装 GLUT 的分步教程吗?
回答by kevintodisco
Your GLUT download will come with .h files, .lib files, and .dll files. Place the .h files in:
您的 GLUT 下载将附带 .h 文件、.lib 文件和 .dll 文件。将 .h 文件放在:
C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/include/GL
Note that the GL folder does not initially exist. You have to create it. You may name it something else if you want. When you include the GLUT header file in your project, you will just have to type:
请注意,GL 文件夹最初并不存在。你必须创造它。如果需要,您可以将其命名为其他名称。当您在项目中包含 GLUT 头文件时,您只需键入:
#include <GL/glut.h>
Or whatever you named the folder you put glut.h in.
或者无论您将 glut.h 放入的文件夹命名为什么。
Next, you have to place the .lib files in the following path:
接下来,您必须将 .lib 文件放在以下路径中:
C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/lib
And when you create your project, make sure you add the .lib files to your Additional Dependencies (Linker->Input->Additional Dependencies).
创建项目时,请确保将 .lib 文件添加到附加依赖项(链接器->输入->附加依赖项)。
Finally, put the .dll files in:
最后,将 .dll 文件放入:
C:/Windows/SysWOW64
This is the folder where 32-bit .dlls are located. System32 contains the 64-bit .dlls. You can also put the GLUT .dlls in System32, if you want to feel safe.
这是 32 位 .dll 所在的文件夹。System32 包含 64 位 .dll。如果您想感到安全,您也可以将 GLUT .dll 放在 System32 中。
And that's it!
就是这样!
Some people may suggest putting all these files directly into your project folder. You should probably notdo this, because for every other project you create with GLUT, you will have to copy those files into it as well. The locations I have mentioned make them universally available to your applications.
有些人可能会建议将所有这些文件直接放入您的项目文件夹中。您可能不应该这样做,因为对于您使用 GLUT 创建的每个其他项目,您也必须将这些文件复制到其中。我提到的位置使它们普遍适用于您的应用程序。
回答by Calidus
Here is a guide for vs 2008 with freeglut, VS 2010 is 90% the same.
这是 2008 年与 freeglut 的指南,与 2010 年 90% 相同。
"Start up the visual Studio environment. This is what was used for the following example but other versions should work the same. Once you start up Visual Studio 2008 the next thing to do is to create a new project using File->New->Project.
“启动 Visual Studio 环境。这是以下示例所使用的环境,但其他版本的工作方式相同。启动 Visual Studio 2008 后,接下来要做的就是使用 File->New-> 创建一个新项目项目。
Choose the Win32 Console Application and set up your project.
选择 Win32 控制台应用程序并设置您的项目。
Once you click okay, a second dialog will appear to configure the project. DO NOT click the Finish button. Click on the Next Button
单击确定后,将出现第二个对话框来配置项目。不要单击完成按钮。单击下一步按钮
This will bring up a second page in the application wizard. You need to turn off precompiled headers (I have periodically had problems with these being out of date) and select to start with an empty project.
这将在应用程序向导中打开第二个页面。您需要关闭预编译头(我经常遇到这些过时的问题)并选择从一个空项目开始。
Now, you will need to copy three files into your empty project. They are glut.h, glut32.lib, and glut32.dll. They may be obtained from the course web site. These should go into your project folder that you created in the previous step. Next you will need to add the glut.h and glut32b files .lias existing files to the project.
现在,您需要将三个文件复制到您的空项目中。它们是 glut.h、glut32.lib 和 glut32.dll。它们可以从课程网站上获得。这些应该进入您在上一步中创建的项目文件夹。接下来,您需要将 glut.h 和 glut32b 文件 .lias 现有文件添加到项目中。
The system may ask if you want to set up compilation rules for the glut32.lib file – you should say no – the file is already compiled and should not need to be recompiled.
系统可能会询问是否要为 glut32.lib 文件设置编译规则——你应该说不——该文件已经编译过了,不需要重新编译。
We will do is change your project configuration properties. Use the menu to go to Project->Properties. Under the properties go to Linker -> Command Line and add two libraries to the list: opengl32.lib glu32.lib"
我们要做的是更改您的项目配置属性。使用菜单转到 Project->Properties。在属性下转到链接器 -> 命令行并将两个库添加到列表中:opengl32.lib glu32.lib”