VS2010配置Opencv 2.x

OpenCV中文论坛已经给出了VC 2010 Express下安装OpenCV2.4.3 http://www.opencv.org.cn/index.php/VC_2010_Express%E4%B8%8B%E5%AE%89%E8%A3%85OpenCV2.4.3 

按照要求做可以正确进行配置。

几个问题:

1、如何判断 X86 还是 X64 ?

2、Lib 和Path路径下的DLL什么关系?

3、VS 属性中 Platform ToolSet  选项v90和v100

4、注意:编译环境和发布模式的lib区别?

5、测试图像Lena.jpg 放到哪个目下? 即 VS project根目录是什么

 下面介绍在使用过程中遇到的几个问题

问题1:VS2010 在默认情况下使用V100编译,使用..\opencv\build\x86\vc9\lib 就无法正常编译通过。

【注意】debug模式用带 XXXd.lib ,release模式下用不带d的lib

解决方法:

在VS2010下,修改默认v100 ->  v90

 

问题2:目标类型、dll和模块类型不匹配

错误提示1:

1>------ Build started: Project: project4Test, Configuration: Debug Win32 ------
1>opencv_highgui243d.lib(opencv_highgui243d.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Opencv lib,路径和lib都改成 x86\vc100对应的即可编译过去

 

错误提示2:
1>------ Build started: Project: project4Test, Configuration: Debug Win32 ------
1>Debug\project4Test.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

解决方法:

以上提示的错误,主要是要编译的目标对象类型和lib不匹配导致的

在默认情况下,创建的项目是win32的(这个就应该是module machine type ,自己猜测的),那么只能编译出X86的目标,同时必须使用X86的lib。这种情况大家不易犯错误。

在考虑编译目标类型为X64的时候:

1、首先修改target machine 为 x64 : project property page -> configuration->linker -> advanced -> Target Machine ,选择 Machine:X64

2、若提示:LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

 The problem has been solved. Many thanks to steve.
Here is the solution, for those might have the same problem :)
1. To choose the x64 platform, click Build > Configuration Manager.  Under Active Solution Platform, select <New...> In the dialog that comes up, select x64 as the new platform (it may come up by default) and then click Ok.
2. select the x64 platform in the VC window.
3. Check the Linker > Command Line property page to make sure there is no /MACHINE switch there
    3.1 if you find /MACHINE ** in the additional options window, just deletle it.
    3.2. if you find /MACHINE ** in the all options window, go to the Linker > Advanced property page and make sure that   Target Machine is "Not Set".
lan
【上述内容摘抄在网络,地址....】

 3、注意linker的lib目录、input对应x64的lib及目录

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值