【问题标题】:Problems with freeglut glew in Visual Studio 2010Visual Studio 2010 中的 freeglut 问题
【发布时间】:2012-05-25 14:18:19
【问题描述】:

我一直在尝试安装 glew 和 freeglut 以与 Visual Studio 2010 一起使用。我遵循了这个 guide 并回溯了几次以确保我正确地遵循它,但是当我尝试和最后编译示例代码:

错误 1 ​​错误 LNK2019:未解析的外部符号 _imp_glutMainLoop@0 在函数 _main c:\Users\Esteban\documents\visual studio 2010\Projects\Chapter 1 Project\Chapter 1 Project\ 中引用main.obj 第一章项目

错误 2 错误 LNK2019:未解析的外部符号 _imp_glutDisplayFunc@4 在函数 _InitWindow c:\Users\Esteban\documents\visual studio 2010\Projects\Chapter 1 Project\Chapter 1 Project\ 中引用main.obj 第一章项目

错误 3 错误 LNK2019:未解析的外部符号 _imp_glutReshapeFunc@4 在函数 _InitWindow c:\Users\Esteban\documents\visual studio 2010\Projects\Chapter 1 Project\Chapter 1 Project\ 中引用main.obj 第一章项目

错误 4 错误 LNK2019:无法解析的外部符号 _imp_glutInitDisplayMode@4 在函数 _InitWindow c:\Users\Esteban\documents\visual studio 2010\Projects\Chapter 1 Project\Chapter 1 Project\ 中引用main.obj 第一章项目

还有更多类似的。我不知道它是否有问题,但最初我不小心抓住了 64 位版本。我意识到我的错误并用 32 位版本覆盖了文件,然后清理并再次尝试构建,结果相同。

【问题讨论】:

  • 您真的完成了指南的第 6 步吗?也就是说,您实际上是在链接库吗?您的错误表明您不是。

标签: visual-studio-2010 opengl freeglut glew


【解决方案1】:

您确定您已正确完成链接指南中的“第 6 步:项目设置(链接器)”吗?链接器似乎无法找到在这些库(glew 和 glut32.lib)中定义的符号。还要确保 Visual Studio 知道在哪里可以找到这些库(项目->属性->配置属性->VC++ 目录->库目录)。

【讨论】:

    【解决方案2】:

    所有未解析的外部符号都应在 freeglut.lib 中找到。您确定您正确链接到此库吗?

    您可以在其中一个头文件中插入以下代码行,而不是尝试在其中完成此操作:

    #pragma comment(lib, "freeglut.lib")
    

    【讨论】:

      【解决方案3】:

      我也有这个问题。原来我使用的是 Visual Studio 的 express 版本,所以我必须下载 microsoft sdk 才能获得 64 位 openGL 库。基本上,我发现本指南更有帮助:http://www.cs.uregina.ca/Links/class-info/315/WWW/Lab1/GLUT/windows.html

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-12-21
        • 2011-03-04
        • 1970-01-01
        • 2011-04-25
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多