# Linker error (x86 - x64)

Hi, I'm trying to compile an OpenCV application on windows for the very first time and, after all sunday afternoon looking in msdn, stackoverflow, this site for a solution my problem is still there. Let's explain it. I followed step by step the guide of the windows installation (including opencv version, 2.4.3), i correctly set the OPENCV_DIR variable and added libs and bin to my visual c++ 2010 express. Then pasted the example code found in the "how to build applications with openCV inside Microsoft Visual Studio" and had this horrible problem: il tipo di computer del modulo 'X86' è in conflitto con il tipo di computer di destinazione 'x64' (my visual studio is in italian, but is the "module machine type 'type1' conflicts with target machine type 'type2'" error described in msdn.microsoft.com)

Whow, that's easy! after 4 hours spent surfing the internet for this solution I got that i have to change the "linker->advanced->target machine" field to x86!

Rebuild, Build, Clean, Build, Rebuild, Clean, Rebuild. Nothing, if I change the target machine to x86 i get this error: 1>opencv_highgui243d.lib(opencv_highgui243d.dll) : fatal error LNK1112: il tipo di computer del modulo 'x64' è in conflitto con il tipo di computer di destinazione 'X86'

Ok.... now, tanke a breath, what is going on here? is my pc x86? is x64? (since this morning i was sure it is x64, and the windows panel agree to me) but vc++ 2010 doesn't.

Thanks in advance for any help and sorry if there are some big mistakes.... (I'm a little bit frustrated)

edit retag close merge delete

Not sure if I am right completely but looks like this one: http://answers.opencv.org/question/27879/error-compiling-opencv-in-vs2010/

( 2014-02-10 02:41:57 -0500 )edit

Sort by » oldest newest most voted

It seems you are pointing to x64 libraries and building it as x86. What is the content of OPENCV_DIR variable? Simply type

set OPENCV_DIR


on your terminal. If it points to 64 libs, something like this D:\OpenCV\Build\x64\vc10
You should change it to x86, with a command like this:

set OPENCV_DIR=D:\OpenCV\Build\x86\vc10


(this will only work for this session) or maybe

setx -m OPENCV_DIR D:\OpenCV\Build\x86\vc10


as super user (open command prompt with administrator capabilities).

I guess this should solve your problem.

Kind regards, Daniel

more

Official site

GitHub

Wiki

Documentation