OpenCV1.1pre1 and Visual C++ 2008 Express
Short Version
Run opencv1.1pre1.exe to install files to C:\Program Files\OpenCV and add C:\Program Files\OpenCV\bin to the system path variable.
Set header, library files and include paths.
(The following may or may not be necessary)
Either
A. Download and install "Microsoft visual C++ 2005 Runtime" library.
OR
B. Recompile the .dll files in VC++ 2008 Express environment.
(Make sure that you have got the C:\Program Files\OpenCV\_make\opencv.vs2005.no_openmp.sln version if you're getting a "can't find omp.h" error.)
Long Version
Problem #1 The code will not compile in the first place.
Usually this means you need to set header, library files and include paths.
Note that the Debug and Release configurations in VC++ have distinct sets of properties: debug configurations include debugging symbols in the compiled program. OpenCV appends a "d" to library names to indicate a debug build e.g. cxcore.lib becomes cxcored.lib, cxcore110.dll becomes cxcore110d.dll.
The remainder of the properties that are common to both build configurations can be set using a .vsprops sheet. (See View>Property Manager in VC2008)
You have to configure three parts of the project properties:
1 Common Properties>C/C++>General should be set to have the paths to the headers for cxcore, cv, and highgui.
For example: "C:\Program Files\OpenCV\cxcore\include";"C:\Program Files\OpenCV\otherlibs\highgui";"C:\Program Files\OpenCV\cv\include"
2 Common Properties>Linker>Input>Additional Dependencies should be set to odbc32.lib odbccp32.lib cxcore.lib cv.lib highgui.lib (note that for the Debug configuration you need to append a d to each cv filename, i.e. cxcored.lib cvd.lib highguid.lib)
3 Last you must set a path so that the program can find the above dependencies. OpenCV should have added this when you installed. If it didn't go to My Computer>R Click>Advanced>Environment Variables, Under System Variables select PATH to edit and add a ;C:\Program Files\OpenCV\bin onto the end if it's not already there.
If you would rather not do all this, open up the C:\Program Files\OpenCV\_make\opencv.vs2005.no_openmp.sln, allow VC++ 2008 Express to update it, and then use the cvsample project to compile your hello world (just exclude stereo_calib.cpp and add your own file in place of it.)
Problem #2 The OpenCV code builds fine, but execution fails with a "Program failed to initialize properly 0xc0150002" error.
This means windows had issues when it was loading the dll libraries: it didn't have permission to read the library, couldn't find the library file, or the program found a library file with the right name, but wrong version of it. I believe that the last is the case here.
Two solutions to this problem:
Download and install "Visual C++ 2005 Redistributable"
Download and install "Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)"
(The SP1 version as of 9/16/2008. You may want to check the "Related Resources" at the bottom of the Microsoft page for more recent updates.)
(Alternative to installing 2005 Redistributable) Recompile the project using Visual C++ 2008 runtime
To recompile OpenCV libraries in VC++2008 Express do the following:
Open C:\Program Files\OpenCV\_make\opencv.vs2005.no_openmp.sln (This is the version for compilers _without_ the open multi-processing library. If you don't know if you have the library or not, make a small hello world as shown in http://en.wikipedia.org/wiki/OpenMP#Hello_World and see if it builds. If it does, then you may use the Open C:\Program Files\OpenCV\_make\opencv.vs2005.sln, which, I assume will mean faster operation in the right environment.)
VS2008 Express will walk you through a wizard updating the file to 2008; nothing important, just click next through it.
There are two configurations to rebuild: Release and Debug. Rebuild means clean before building or delete all files in OpenCV\lib and in OpenCV\bin before building. This rebuilds the dll files in C:\Program Files\OpenCV\bin. Remember to rebuild for both Release and Debug configurations, otherwise you will only be able to run your programs with the matching configuration.
Hopefully that takes care of the problem.