Stuff you have to do to get opencv to work
Clean Install of OpenCV
install microsoft visual c++ 2010 express (express is free)
install windows SDK (7.1)
(optional but recommended) install cuda
install CMake
install opencv
open the opencvconfig.cmake file in opencv/build
in cmake, source code: e:\opencv
build the binaries: anywhere - I did e:\opencv\build64
click configure. (specify generator? VS2010, or vs2010 x64?)
a bunch of options (highlighted red) should appear. Make sure 'advanced' is checked (top right) and search through the entries. Disable the 'enable solution folders' option
if including cuda, set enable_cuda and the cuda installation dir (recommended)
click configure twice, then generate once. close cmake.
open the new .sln file in e:\opencv\build64 ( i don't know why it asks if you want to open in vs 10 or vs2010 - they seem to do the same thing)
at the top of vs2010 click the Win32, go to configuration manager, create new platform, find Win64 in the dropdown, click ok/close
hit f7 (build project) - may take hours
Errors I've gotten
Cannot open file kernel32.lib:
The file is located in:
C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib
include this in your project linker settings or set path?
http://blogs.msdn.com/b/saurabh_singh/archive/2009/01/30/getting-fatal-error-lnk1181-cannot-open-input-file-kernel32-lib.aspx
nvcc : fatal error : Visual Studio configuration file '(null)' could not be found :
http://stackoverflow.com/questions/2970493/cuda-linking-error-visual-express-2008-nvcc-fatal-due-to-null-configuratio
create new project -> win32 console application. Time to set your settings for opencv.
tools->settings->enable expert settings (so you can see the property manager)
view->property manager -> add new project property sheet. it will appear in the solution explorer list. right click it->properties. use these settings (so you don't have to redo all these settings if you have to start over - you can just load an existing property sheet):
in VC++ directories, include directories:
E:\opencv\build\include
library directories
E:\opencv\build\x64\vc10\lib
Configuration Properties does not have an option i'm looking for:
In your solution explorer you need to have the correct file/entry selected. If compiling the binaries, look for ALL_BUILD in the list?
system error - the program can't start because opencv_corexxx is missing from your computer -
include path in env variables, restart computer
unresolved external symbol __imp_EncodePointer
need to include files from the SDK. In properties->linker->general->include additional folders put:
C:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64
1>opencv_core243d.lib(opencv_core243d.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
change the Win32 at the top of vs2010 to x64
ConfigurationGeneral not found
http://support.microsoft.com/kb/2519277?wa=wsignin1.0 bug when you upgrade to a SP1 - x64 compilers are removed.
"encountered an unknown error and has to close"
"Microsoft VC Express has stopped working"
reinstall windows. seriously. Reinstalling Everything else does NOT work. Only reinstalling windows works.
Event viewer (administration tools) should have more details, somewhere in there it will show the actual .dll the APPCRASH occured. Open procmon, capture the crash, then search for that .dll -
capture dump by putting procdump in the .exe file and executing procdump.exe -e VCExpress.exe right before you crash it
try turning off IIS and windows update before installs?
Permissions issue?
TakeOwn /F C:\ProgramData\Microsoft /R /D y
then
icacls C:\ProgramData\Microsoft /grant Administrators:F /T
http://go4answers.webhost4life.com/Example/microsoft-visual-studio-web-authoring-8105.aspx
bcc32 not found in cmake
You did not specify the correct compiler. in CMake, file->clear cache. Click configure, this time make sure you select the correct compiler (eg. visual studio 10)
CMake could not detect the bitness of the target platform
happened when I selected visual studio 10 win64 as the compiler. file->clear cache, reselect compiler
vs2010 crashes when you try to build/compile:
bug with windows 7 64 bit, use patch: http://www.microsoft.com/en-us/download/details.aspx?id=4422
fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
.net 4.5 does not work with vs2010 or you uninstalled something then reinstalled (eg installed vs2012, realized it wasnt free, uninstalled, installed vs2012) - install vs2010 service pack 1
What must be set in Properties:
General->Platform Toolset = Windows7.1SDK
VC++ libraries,
Environment path must point to your opencv_coreXXX.lib
D:\Program Files\OpenCV\opencv240\opencv\build\x64\vc10\bin
Need to build the binaries for debugging to work
If using VS express, and building the binaries, must turn off ENABLE_SOLUTION_FOLDERS in CMake->enable before you generate.
VS freezes when trying to create an x64 configuration?
Windows7.1SDK without having to set it every time.
http://social.msdn.microsoft.com/Forums/en-NZ/vcgeneral/thread/7c7e04e3-6495-405f-96ff-77ac2414a5a1
if you get an error saying something like ‘target machine is x86’, need to make sure the project type matches your machine. See up top where it says win32? Click on that dropdown->configuration manager->platform (click dropdown)->add new, click on top dropdown and find x64, make sure ‘create platform solution’ is checked, hit ok
link error cannot find lib/debug/opencv_coreXXX.lib
Find the files, copy them to the lib/debug directory
Or set your environmental PATH variable (be sure to reset)
nvcc fatal : Visual Studio configuration file '(null)' could not be found for installation at 'd:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/../..'
2> CMake Error at cuda_compile_generated_matrix_operations.cu.obj.cmake:198 (message):
I solved the problem by 1. installing Windows SDK (don't forget to choose all x64 options for 64 bit OS) 2. include "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64" in PATH 3. create file vcvars64.bat inside directory "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64" with following content: call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
Note: I did this because: 1. I am using VC++ Express 2010 2. I dont have "vcvars64.bat" in any directory
Create a configuration file (.prop file) you can reuse! View->property manager->create new property sheet, save. Reload it in a new project with view-propertymanager->add existing property sheet (navigate to where you saved the .prop file)
http://stackoverflow.com/questions/2970493/cuda-linking-error-visual-express-2008-nvcc-fatal-due-to-null-configuratio
Additionally, you might see the error message that “tbb_debug.dll” is missing when starting your application. The
“Intel® Threading Building Blocks (Intel® TBB)” needs to be installed (partly) as well. Therefore, download the
latest stable release for your OS at http://threadingbuildingblocks.org/download.php. As of today, the latest
stable release was tbb40_20120408oss. If you unzip the files, you might either install the whole package or at
least copy the tbb_debug.dll (check OS, 32 oder 64 bit, VS version) to the same directory as your application.
Cannot find or open the PDB file"
This is what happened to me, on my first project without a template. All the linking and libraries, runtime
information are correct. It is JUST the symbols. I followed your suggestion:
Debug>Options and Settings> Symbols and selected the Microsoft Servers.
Enable "cache symbols {in this directory}" and set a location. Then you only have to wait for the servers once.
More importantly, your project now knows where a local copy of the pdb files is.
linker files:
opencv_core243d.lib
opencv_highgui243d.lib
opencv_video243d.lib
opencv_ml243d.lib
opencv_legacy243d.lib
opencv_imgproc243d.lib
opencv_objdetect243d.lib
opencv_features2d243d.lib
opencv_calib3d243d.lib
opencv_contrib243d.lib
opencv_flann243d.lib
kernel32.lib not found:
This is from the microsoft Software Development Kit
include
D:\Program Files\Microsoft SDKs\Windows\v7.1\Lib
Property Manager->(Root node, i.e. the projectname)->Configuration Properties->General->Platform Toolset = Windows7.1SDK
And magically it works.
Now I have to work out if there's a way to get all new projects to use the Windows7.1SDK without having to set it every time.
http://social.msdn.microsoft.com/Forums/en-NZ/vcgeneral/thread/7c7e04e3-6495-405f-96ff-77ac2414a5a1
Additionally, you might see the error message that “tbb_debug.dll” is missing when starting your application. The “Intel® Threading Building Blocks (Intel® TBB)” needs to be installed (partly) as well. Therefore, download the latest stable release for your OS at http://threadingbuildingblocks.org/download.php. As of today, the latest stable release was tbb40_20120408oss. If you unzip the files, you might either install the whole package or at least copy the tbb_debug.dll (check OS, 32 oder 64 bit, VS version) to the same directory as your application.
Cannot find or open the PDB file"
This is what happened to me, on my first project without a template. All the linking and libraries, runtime information are correct. It is JUST the symbols. I followed your suggestion:
Debug>Options and Settings> Symbols
and selected the Microsoft Servers.
Enable "cache symbols {in this directory}" and set a location. Then you only have to wait for the servers once. More importantly, your project now knows where a local copy of the pdb files is.
linker files:
opencv_core243d.lib;opencv_highgui243d.lib;opencv_video243d.lib;opencv_ml243d.lib;opencv_legacy243d.lib;opencv_imgproc243d.lib;opencv_objdetect243d.lib;opencv_features2d243d.lib;opencv_calib3d243d.lib;opencv_contrib243d.lib;opencv_flann243d.lib;%(AdditionalDependencies)
kernel32.lib not found:?
This is from the microsoft Software Development Kit
include
D:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64 in linker?
Always because VS cannot find the windows SDK. First make sure properties v100 is changed to SDK 7.1. If you cannot find the properties make sure ALL_BUILD is selected?
ALL_BUILD is the name of the solution - each entry under it is a project. Must go into each project individually and put in D:\Program Files\Microsoft SDKs\Windows\v7.1\Lib\x64.
There's a lot - to reduce the amount, go back to cmAKE and remake the project, this time uncheck anything that you dont need. Under CMake->build-> uncheck everything except BUILD_opencv_core, feature2d, gpu, highgui, improc (and whatever other modules you know you will need). Same for under CMake->with-> uncheck everything except with_cuda (hasn't errored for me yet, anyways :))
project automatically have SDK selected, and x64 the default built?
http://stackoverflow.com/questions/5241975/how-to-create-a-project-with-x64-platform-by-default-in-the-visual-studio-under
change win32 to x64 in Microsoft Visual Studio 10.0 Install Path>\VC\VCWizards\default.vcxproj
(also the spot to change default preoprty sheet!)
when including CUDA, building, getting nvcc fatal due to (null) configuration file:
create file vcvars64.bat inside directory "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64" with following content: call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
http://stackoverflow.com/questions/2970493/cuda-linking-error-visual-express-2008-nvcc-fatal-due-to-null-configuratio
"No GPU support" :
copy opencv_core243d.dll from E:\opencv\build\gpu\x64\vc10\lib folder to your work directory with the .exe.
http://comments.gmane.org/gmane.comp.lib.opencv/50774
Had to fill in properties->VC++ directories->include directories with E:\opencv\build\x64\vc10\bin;E:\opencv\build\gpu\x64\vc10\bin;$(IncludePath)
even though it already appeared in the 'inherited dependancies' down below (maybe it was the order...)?
there also seems to be a difference between clicking on 'debug' in the solution manager and going into properties, vs clicking on the actual property sheet just below debug, and going into properties.
cudart64_42_9.dll not found:
42 refers to version 4.2 of the cuda library.
This file is part of the CUDA SDK. 5.0 does not seem to install a separate SDK. Go find the cuda 4.2 download page and download the SDK. It installs to the hidden ProgramData dir. You'll have to find it, and include the path to the sdk in CMake, in the Cuda->CUDA_SDK_ROOT_DIR option.
speed up execution:
after symbols are checked in options->debugging, you can load a project once then turn this off. The symbols will be loaded from the cache.
Also in tools->options->debugging->general, click'enable just my code' (as opposed to MS .net srouce code so you can debug DLLS )
(VS2008) disable source server support