opencv做三维重构程序调试中出现的问题解决方案

本文档详细介绍了在Visual Studio环境中配置OpenGL遇到的问题及解决方案,包括如何解决未解析的外部符号错误,以及如何处理因缺少glut32.dll而导致的程序启动失败问题。

1.opencv和OpenGL的配置

参考牧野的博客OpenGL+VS2012编译环境配置:http://blog.youkuaiyun.com/dcrmg/article/details/53049070

2.OpengGL 在配置时 出现__imp____glutInitWithExit@12 或__imp____glutCreateWindowWit

 

unresolved external symbol __imp____glutInitWithExit@12 unresolved external symbol__imp____glutCreateWindowWithExit@8
I have the folling files in the following locations: -
glut.h
glu.h
gl.h
C:\Program Files\Microsoft Visual Studio 8\VC\include\GL

glut.32.lib
C:\Program Files\Microsoft Visual Studio 8\VC\lib

glut32.dll
glu32.gll
C:\WINDOWS\system32

I make a new project (Win32 Console App).
Set the Additional Dependencies under
Project | Properties | Config Properties | Linker | Input
I have: -
opengl32.lib glu32.lib glut32.lib

This is basically what just about every site I look at tells me to do.
So I copy over some code that I know compiles and runs under my Dev C++ setup...
And it fails to compile with the following errors: -
1>main.obj : error LNK2019: unresolved external symbol __imp____glutInitWithExit@12 referenced in function _glutInit_ATEXIT_HACK@8

1>main.obj : error LNK2019: unresolved external symbol __imp____glutCreateWindowWithExit@8 referenced in function _glutCreateWindow_ATEXIT_HACK@4

This is didn't happen a little while ago, as I was trying to solve a previous problem. This was that when I tried to run a successfully compiled program, an error would say: -
The procedure entry point __glutInitWithExit could not be located in the dynamic link library glut32.dll

solution:
Try define the following line right before including the header, glut.h.

#define GLUT_DISABLE_ATEXIT_HACK


3.运行出现问题:无法启动此程序因为计算机丢失glut32.dll

将下载的压缩包解开,将得到5个文件(glut.dll, glut32.dll, glut.lib, glut32.lib,glut.h)

1)把glut.h复制到x:\Program Files\Microsoft\Visual Studio 10.0\VC\include\gl文件夹中,如果没有gl这个文件夹则可以自己新建一个。(x是你安装VS的盘符号)

2)把解压得到的glut.lib和glut32.lib放到静态函数库所在文件夹(即与include并排的lib文件夹下)。

3)把解压得到的glut.dll和glut32.dll放到操作系统目录下面的system32文件夹内。(典型的位置为:C:\Windows\System32)

(注:如在开发应用程序时用到OpenGL辅助库函数,则还需下载相应动态链接库,包含glaux.dll, glaux.lib, glaux.h,相应步骤同上)

 解决方法:如果是windows7 32位系统,那么上述环境配置已经完成。如果是64位系统话按照上述设置,当编译一个程序是会图示错误“无法启动此程序,因为计算机中丢失glut32.dll。。。”。问题出在第(3)步,这时应该将glut.dll和glut32.dll放到操作系统目录下面的C:\Windows\SysWOW64文件夹内,这时再编译就没有问题了。

 


评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值