Ask Your Question

Revision history [back]

Error compiling OpenCV in VS2010

I recently downloaded OpenCV and I haven't been able to compile the demo program. I downloaded the latest version and when compiling in VS2010 I get the following error:

1>Debug\opencv.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'

It's a basic error but quite honestly I can't seem to find out what's causing it. I'm using the following software:

  • Windows7, 64 bit
  • VS2010
  • OpenCV 2.4.8

I followed all the steps from the installation tutorial, as follows:

Environment variable: OPENCV_DIR S:\OpenCV\build\x86\vc10 On Windows Path: S:\OpenCV\build\x86\vc10\bin

In VS2010:

  • At C/C++ "Additional include directories": S:\OpenCV\build\include
  • Linker->General->Additional Library Dependencies: $(OPENCV_DIR)\lib
  • Linker->Input->Additional Dependencies (for Debug):

opencv_core248d.lib opencv_imgproc248d.lib opencv_highgui248d.lib opencv_ml248d.lib opencv_video248d.lib opencv_features2d248d.lib opencv_calib3d248d.lib opencv_objdetect248d.lib opencv_contrib248d.lib opencv_legacy248d.lib opencv_flann248d.lib

  • Linker->Advanced->Target Machine: MachineX86

  • Linker->Command Line-> There is no /MACHINE:X64 there, only /MACHINE:X86

I did try to change these settings to run in 64 bits but I STILL get an error, only this time it's the opposite (instead of x86 conflicts with x64, i get x64 conflicts with x86). Tried to google for any way to solve this but haven't found a solution for my particular problem.

Any sort of help would be greatly appreciated.

Regards, Nuno