Home >Backend Development >C++ >How to Resolve the 'LNK1104: cannot open file 'lib.obj'' Error When Setting Up OpenCV 2.3 with Visual Studio 2010?
While integrating OpenCv 2.3 with Visual Studio 2010 Express, you may encounter the fatal error "LINK : fatal error LNK1104: cannot open file 'c:OpenCV2.3buildx86vc10lib.obj'." This occurs because there is no lib.obj in the OpenCV folders, often due to skipping the CMake compilation step.
Resolution:
To alleviate this issue, follow these steps:
Add Include Directories:
Configuration Properties > C/C > General > Additional Include Directories:
Add Library Directories:
Configuration Properties > Linker > General > Additional Library Directories:
Add Libraries:
Configuration Properties > Linker > Input:
Modify PATH Variable:
Append the OpenCV DLL location to the PATH environment variable:
Build Project:
Run Application:
Execute Code:
Run the code sample provided:
#include <stdio.h> #include <cv.h> #include <highgui.h> int main(int argc, char* argv[]) { if (argc < 2) { printf("Usage: ./opencv_hello <file.png>\n"); return -1; } IplImage* img = cvLoadImage(argv[1], CV_LOAD_IMAGE_UNCHANGED); if (!img) { return -1; } cvNamedWindow("display", CV_WINDOW_AUTOSIZE); cvShowImage("display", img); cvWaitKey(0); return 0; }
The above is the detailed content of How to Resolve the 'LNK1104: cannot open file 'lib.obj'' Error When Setting Up OpenCV 2.3 with Visual Studio 2010?. For more information, please follow other related articles on the PHP Chinese website!