c++ - How to fix the fatal error LNK1112 and LNK1120 in VS 2010 -


I have a VS Starting with OpenCV 2.3 in 2010, there are so many things that I do not know. I have installed OpenCVY by following the guide:

But I could not choose to "Create a new project platform" in step 4 to create a project. And when I put the code, I had many problems.

1> opencv_highgui230d.lib (opencv_highgui230d.dll): Fatal error LNK1112: module machine type 'x64' conflict with target machine type 'x86' P>

if i waitKey () , then I get the error:

1> C: \ user \ gia linha \ document \ visual studio 2010 \ projectss \ testopencv \ debug \ testopencv Exe: Fatal Error LNK1120: Unsolved Unknowingly

I do not know how to fix it. Please help me Thanks a lot!

  #include "stdafx.h" #includes & lt; Stdio.h & gt; #include "cv.h" # included "highgui.h" using namespace cv; Int _tmain (int argc, _TCHAR * argv []) {char * imagename = "lena.jpg"; Mat img = imread (imagename); If (img.empty ()) {fprintf (stderr, "image% s \ n", imagename can not be loaded); Return -1; } If (! Img.data) return -1; Nominated Window ("Show an Image", CV_WINDOW_AUTOSIZE); Imshow ("Show an IMG", IMG); WaitKey (); Return 0; It seems that you are connected to opencv of x64 dll and lib and try to run. Under this visual studio's x86 configuration! Try adding another way to "Opencvdir / build / x86 / vc10 / bin" to the environment variable and check all the paths in it: (I assume that you are trying to run x86 project) 

Project Properties> Configuration Properties> Linker> General> Additional Library Directories: Something like this should be: OpencvDIR \ build \ x86 \ vc10 \ lib.

and

Project Properties> Configuration Properties> Linker> Input> Additional Dependency: The proper Lib file name should be, if you are in debug mode, then they will be filename (for debug Stands) should be with "D" at the end and without it if you are in release mode

I would also like to suggest creating a property sheet for opencv instead of adding to project settings!


Comments