Hello ,

I have just started dealing with OpenCV and tried to open an sample.I am using version b4a. And when i opened a sample source file(for example:face detect). I compile source file(face detect) and it(visual stdio 6.0) gives 0 error or warning. But when i tried to run it gives 21 linking error!!

Is this normal? Or how can i prevent this?
Thanx in advance



Is this normal?

No. Errors are not normal.

Or how can i prevent this?

By telling the linker where your library files are. There is a option in your project settings to specify the directories to search for library files. Use that.

Thanx in advance

You are welcome.

Thank you but now it gave another error!
"Unexpected end of file found while expecting ..."
But it was giving no such fault before!

You can turn off precompiled headers by selecting menu item Project --> Settings, select the c++ tab, in "Category" select "Precompiled Headers" then select the "Not using precompiled headers" radio button.

Thank you so much! I did what you said but it gave no change! It gave same error again."...end of file while looking for precompiled header directive"???

What is my fault anyone knows? Or any one can explain me from starting "how to compile and run an opencv sample in VC++6 "
I need your help.
Thank you so much

Since you have already started the project and added the *.cpp files you may have to turn off precompiled headers for each individual *.cpp file. In File View select a *.cpp file then turn off precompiled header as previously explained. Do that for each *.cpp file you sdee in File View. If there are lots of files it might be faster and easier to just start a new empty project, turn off precompiled headers, then add the *.cpp files to it.

Another way to resolve the problem is to add #include "stdafx.h" at the top of each *.cpp file (before any other include directives)

Again thanks. At last i get rid of this fault but this time it gave"skeleton.obj : error LNK2005: _main already defined in contours.obj" this error.
Do i have to install another release of OpenCV?

>>Do i have to install another release of OpenCV?
No, apparently the file contours.cpp already contains a main() function. You can remove the main() that you added to skeleton.cpp, or remove contours.cpp from the project.

Thank you for your helps but infact while these were correcting one fault others errors occured. At last i installed VS.Net 2005 and openCV 1.0. An now it works well. I think the problem occures from that release of openv or VS 6.0.

The problem is now solved thank you.

i now installed VS.net 2005 and opencv 1.0. And it works well now. Thank u fro your helps.


I got the latest openCV from sorceforge.net (openCV 2.0). Then I installed it. Now in order to work with open CV in C++, required dll files should be in the system folder, .h files should be in the include folder inside the visiual studio folder.. and the .lib files inside the vc folder. I didnt have a problem with the .h files as they were inside a folder(include) in the opnCV folder. But for the other files they wer not present and as i read form the documentation, I needed to get cMake then use it to generate some files then compile with c++ to get the required files. I got cMake and i used it like they said in the doc. Now, i do not know how to get the .h file form the .h.make file, im not sure if i generated all the req files and after opening opencv.suo and compiling all the files (some files didnt compile cus of: cannot find cvconfig.h, didnt know how to generate this type of file) and im not sure if i got the req. files as i saw different names (ex. cv200d.dll.embed.manifest (i just rename it to cv.dll?). If anyone has installed and used the latest version of open cv sucessfully or can help in anyway, i'll be greatly appreciared. Thanks for your support

This question has already been answered. Start a new discussion instead.