C++ 如何在 Windows 机器上构建或安装 freeglut
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11298963/
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 build or install freeglut on a windows machine
提问by P.Brian.Mackey
I downloaded freeglut. I'm reading the installation instructions. I extracted all the files. I see a file called configure (and configure.ac). I opened visual studio command prompt and changed the directory to
我下载了freeglut。我正在阅读安装说明。我提取了所有文件。我看到一个名为 configure(和 configure.ac)的文件。我打开了 Visual Studio 命令提示符并将目录更改为
C:\DevStuff\OpenGL\freeglut-2.8.0
C:\DevStuff\OpenGL\freeglut-2.8.0
The next step is to configure the packages
下一步是配置包
./configure
./configure
This looks like a Linux command. How am I supposed to complete this kind of a build on a windows 7 machine? I have visual studio 2010 ultimate ed.
这看起来像一个 Linux 命令。我应该如何在 Windows 7 机器上完成这种构建?我有 Visual Studio 2010 终极版。
UPDATE
更新
I found the VS2010 directory and successfully performed a build. I need freeglut_static.lib
, which did not come out of this build. The output directory
我找到了 VS2010 目录并成功执行了构建。我需要freeglut_static.lib
,这不是从这个构建中出来的。输出目录
..\..\lib\x86\Debug
contains only one lib file, freeglut.lib.
..\..\lib\x86\Debug
只包含一个 lib 文件,freeglut.lib。
I suspect I need the makefile, but I really don't know. This lib is required for OpenGL Superbible sample projects. In the sample projects when I try to run it a compilation error:
我怀疑我需要 makefile,但我真的不知道。OpenGL Superbible示例项目需要此库。在示例项目中,当我尝试运行它时出现编译错误:
error LNK1181: cannot open input file 'freeglut_static.lib' C:\DevStuff\OpenGL\SB-WinwBin\SuperBible4\examples\projects\microsoft\chapt01\block\LINK block
回答by P.Brian.Mackey
Info for anyone trying to get the samplesfor 4th ed OpenGL superbible to work on a Windows box.
信息任何人试图让样品在Windows中为第4版工作的OpenGL OpenGL超级。
The website comes with everything you need. No need to build or install freeglut seperately. It's just that the projects are not configured correctly. For visual studio 2010, here's the fix for the first project entitled block:
该网站提供了您需要的一切。无需单独构建或安装 freeglut。只是项目没有正确配置。对于 Visual Studio 2010,这是第一个名为 block 的项目的修复程序:
Right click the project > properties > VC++ Directories > Library Directories(not Include directories) > Add a link to the freeglut_static.lib which comes with the download. E.G.
C:\DevStuff\OpenGL\SB-WinwBin\SuperBible4\examples\src\shared;
If you build now, you will get a new error regarding inability to link LIBC.lib. With the project properties still open go to Linker > Input > Ignore Specific Default Libraries > click the dropdown arrow > click
<Edit...>
> typeLIBC.lib
and click ok.
右键单击项目 > 属性 > VC++ 目录 >库目录(不包括目录)> 添加指向下载附带的 freeglut_static.lib 的链接。例如
C:\DevStuff\OpenGL\SB-WinwBin\SuperBible4\examples\src\shared;
如果您现在构建,您将收到关于无法链接 LIBC.lib 的新错误。在项目属性仍然打开的情况下,转到链接器 > 输入 > 忽略特定默认库 > 单击下拉箭头 > 单击
<Edit...>
> 键入LIBC.lib
并单击确定。
Now everything should build just fine.
现在一切都应该建立得很好。
回答by genpfault
How am I supposed to complete this kind of a build on a windows 7 machine?
我应该如何在 Windows 7 机器上完成这种构建?
MSYS.
系统。
Or use the VS2010 solution in the VisualStudio\2010
directory.
或者使用VisualStudio\2010
目录中的VS2010解决方案。
EDIT:
编辑:
If you need freeglut_static.lib
use the Debug_Static
or Release_Static
configurations in freeglut.sln
.
如果你需要freeglut_static.lib
使用Debug_Static
或Release_Static
配置请在freeglut.sln
。