I have followed the OpenCV guides for installation in Windows and setting of Visual Studio but I have problem if I understood all step correctly. The folder structure is different.
My system is Windows XP. IDE Visual Studio 2010. Downloaded and installed OpenCV 3.1
@echo %OPENCV_DIR%
prints
P:\PROGRAMY\programming\OpenCV
notice: I have added both as system environment variable (+rebooted PC) and as user environment variable (+relogged user, no reboot).
here is my directory structure:
>p:
>cd \PROGRAMY\programming\OpenCV
>dir /b /o:d
build 3.1
sources
>cd \PROGRAMY\programming\OpenCV\build 3.1
>dir /b /o:d
bin
include
etc
lib
These folders I have moved from installation folder from build. I use 32 bit Windows, I skipped Java, Perl and 64 bit things. Note there is bin/opencv_ffmpeg310.dll and lib/opencv_ffmpeg310.dll - same size files - only dlls/lib I have. I expect this to be the opencv main library, right?
The P:\PROGRAMY\programming\OpenCV\build 3.1\include\ has two folders opencv and opencv2 ? Here it is not clear which folder should be included because in doc one one folder is shown.
>cd \PROGRAMY\programming\OpenCV\sources
>dir /b /o:d
>dir /b /o:d
samples
platforms
modules
include
doc
data
cmake
apps
3rdparty
here are all sources
In my project I have set Release and Debug profile:
Linker -> General -> Additional Library Dependecies: $(OPENCV_DIR)\build 3.1\lib
Linker -> Input .. no change here. Here are standard Windows libraries:
kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
I tried to add one library but I found the lib files are not part of the distribution. (sad).
I have read there is needed to add some libraries, but no *.lib files I found in the folders.
Now I have created the file main.cpp
which includes these files:
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
then I build and I got this error:
1>------ Build started: Project: OPEN CL, Configuration: Debug Win32 ------
1>LINK : error LNK2001: unresolved external symbol _mainCRTStartup
1>U:\C++\openCV\test 00\Debug\OPEN CL.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Note that if I include both directories include/opencv and include/opencv2 it still generates same error.
What do I do wrong during installation that I am not able to compile the program in guide? Do I need to include some lib files?
Links:
http://docs.opencv.org/2.4/doc/tutorials/introduction/windows_install/windows_install.html#windows-installation
http://docs.opencv.org/2.4/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html#windows-visual-studio-how-to
Edit:
After creating new clear project and setting include directories I can compile single program. But when I try to include OpenCV core so it will print error. Do I need to link any library? Which file? I cannot link opencv_ffmpeg310.dll it would print error that file is corrupt (There are two files like this, both error). How to tell program where is core?
Edit 2:
For project Install, after I completed Release Build it prints this:
1>------ Skipped Build: Project: opencv_calib3d_object, Configuration: Release Win32 ------
1>Project not selected to build for this solution configuration
2>------ Skipped Build: Project: opencv_core_object, Configuration: Release Win32 ------
2>Project not selected to build for this solution configuration
3>------ Skipped Build: Project: opencv_features2d_object, Configuration: Release Win32 ------
3>Project not selected to build for this solution configuration
4>------ Skipped Build: Project: opencv_flann_object, Configuration: Release Win32 ------
4>Project not selected to build for this solution configuration
5>------ Skipped Build: Project: opencv_highgui_object, Configuration: Release Win32 ------
5>Project not selected to build for this solution configuration
6>------ Skipped Build: Project: opencv_imgcodecs_object, Configuration: Release Win32 ------
6>Project not selected to build for this solution configuration
7>------ Skipped Build: Project: opencv_imgproc_object, Configuration: Release Win32 ------
7>Project not selected to build for this solution configuration
8>------ Skipped Build: Project: opencv_objdetect_object, Configuration: Release Win32 ------
8>Project not selected to build for this solution configuration
9>------ Skipped Build: Project: opencv_photo_object, Configuration: Release Win32 ------
9>Project not selected to build for this solution configuration
10>------ Skipped Build: Project: opencv_shape_object, Configuration: Release Win32 ------
10>Project not selected to build for this solution configuration
11>------ Skipped Build: Project: opencv_stitching_object, Configuration: Release Win32 ------
11>Project not selected to build for this solution configuration
12>------ Skipped Build: Project: opencv_superres_object, Configuration: Release Win32 ------
12>Project not selected to build for this solution configuration
13>------ Skipped Build: Project: opencv_video_object, Configuration: Release Win32 ------
13>Project not selected to build for this solution configuration
14>------ Skipped Build: Project: opencv_videoio_object, Configuration: Release Win32 ------
14>Project not selected to build for this solution configuration
15>------ Skipped Build: Project: opencv_videostab_object, Configuration: Release Win32 ------
15>Project not selected to build for this solution configuration
16>------ Skipped Build: Project: RUN_TESTS, Configuration: Release Win32 ------
16>Project not selected to build for this solution configuration
17>------ Skipped Build: Project: uninstall, Configuration: Release Win32 ------
17>Project not selected to build for this solution configuration
18>------ Skipped Build: Project: opencv_ml_object, Configuration: Release Win32 ------
18>Project not selected to build for this solution configuration
19>------ Skipped Build: Project: opencv_modules, Configuration: Release Win32 ------
19>Project not selected to build for this solution configuration
20>------ Skipped Build: Project: opencv_perf_tests, Configuration: Release Win32 ------
20>Project not selected to build for this solution configuration
21>------ Skipped Build: Project: opencv_tests, Configuration: Release Win32 ------
21>Project not selected to build for this solution configuration
22>------ Skipped Build: Project: PACKAGE, Configuration: Release Win32 ------
22>Project not selected to build for this solution configuration
23>------ Skipped Build: Project: INSTALL, Configuration: Release Win32 ------
23>Project not selected to build for this solution configuration
========== Build: 0 succeeded, 0 failed, 210 up-to-date, 23 skipped ==========