Problem in configuring opencv 2.2 on windows 7 (64-bit): - visual-studio-2010

I have windows 7 (64-bit) and I am trying to configure opencv 2.2 for Microsoft visual studio 2010, I followed the instructions given in the book OpenCV 2 Computer Vision Application Programming Cookbook , but it’s not working, I performed the following steps:
Compile opencv 2.2 using cmake, (source code: C:/OpenCV-2.2.0, where to build binaries: C:/OpenCV-2.2.0/build)
Open OpenCV.sln (which is made as a result of compiling by cmake in the folder C:\OpenCV-2.2.0\build), this is opened in visual studio, I build it (result of build: no errors, few warnings).
Add new property sheet to my project, and in VC++ directories, under the “Include Directories “ I give the path of C:\OpenCV-2.2.0\include\opencv and under the “Library Directories” I give the path of my lib files i.e C:\OpenCV-2.2.0\build\lib\Debug.
Within the linker tab under the Input, included the following Additional dependencies:
opencv_core220d.lib
opencv_highgui220d.lib
opencv_features2d220d.lib
opencv_calib3d220d.lib
According to the instructions on the book now everything should be configured correctly, but when I include header files,(after typing (Hash)include (angle bracket)) the intellisense only gives:
#include <cxcore.h>
#include <cv.h>
but instead it should had displayed
#include <opencv2/core/core.hpp>
and when I write
#include <opencv2/core/core.hpp>
it gives me error cannot open source file
“opencv2/core/core.hpp“ ,
if I include
#include <cv.h >
I got 11 errors:
1. IntelliSense: cannot open source file "opencv2/core/core_c.h" c:\opencv- 2.2.0\include\opencv\cv.h 63 1
2. IntelliSense: cannot open source file "opencv2/core/core.hpp" c:\opencv-2.2.0\include\opencv\cv.h 64 1
3. IntelliSense: cannot open source file "opencv2/imgproc/imgproc_c.h" c:\opencv-2.2.0\include\opencv\cv.h 65 1
4. IntelliSense: cannot open source file "opencv2/imgproc/imgproc.hpp" c:\opencv-2.2.0\include\opencv\cv.h 66 1
[The remaining errors are similar to the above errors.]
I have not included anything under the C/C++ -> General -> Additional Include Directories
in the property sheet, is there any need to include anything there ???
Can anybody please tell me, what I did wrong in the configuring process?
Is there any guide available specifically for configuring opencv 2.2 on windows 7 (64-bit) on visual studio 2010?

Maximus solution sounds like a spray and pray attempt.
I cleanly only added [opencvDir]\include to my visual studio includes and it all worked really fine.
Including with your syntax
#include <opencv2/core/core.hpp>
works just fine, thats how i do it. The rest of the steps I did was exactly what you described, except that I have different projects with different parallel opencv installations, so i did not add OpenCV to my global environment variable "PATH" but rather than that I selectively use OpenCV for each project by selection Project Properies (right click project, select properties) => Debugging => "Environment" : Set to PATH=$(SolutionDir)Dependencies\opencv2.2\x86\bin" (in my case), and "merge environment" to "yes"
That is necessary so opencv finds its DLLs in case you link non-static.
Hope that helps :)

You need two include directories. For me it was, C:\OpenCV2.2\include and C:\OpenCV2.2\include\opencv

Try including all directories in C:\opencv-2.2.0\modules\module_name\include
For example in your case it could be
C:\opencv-2.2.0\modules\core\include\
C:\opencv-2.2.0\modules\imgproc\include\
and many more. You should use comand line to get that list of directories in the C:\opencv-2.2.0\modules. And after each add include.
I don't know why does this happens..

In my property page,
in C/C++ -> Addictional Include Directory
I was using "%OPENCV_DIR\build\include"
Replacing by the real path fixed the issue with intellisense:
"C:\opencv\build\include"
I am running opencv 2.4.2 and Visual Studio 2010 SP1.

Related

Trying to compile pgAgent. Get an error wx/setup.h: No such file or directory

On one of our servers pgAgent service does not start with the message "ERROR: Couldn't register event handle" (see DBA Question). So I decided to compile the binary from the source, to further investigate the problem.
I installed Visual Studio Community 2017 Edition. I downloaded pgagent source code 3.4.0 and extracted to F:\pgbuild\pgAgent-3.4.0. I downloaded the wxWidgets 2.8, unpacked into F:\pgbuild\wxWidgets and built with visual studio 2017. I pointed out the these variables
wxMSW=F:\pgbuild\wxWidgets
WXWIN=F:\pgbuild\wxWidgets
PGDIR=C:\Program Files\PostgreSQL\9.6
WIX=C:\Program Files (x86)\WiX Toolset v3.11\
Then I tried to compile the pgAgent. Visual studio could recognize the CMake Project of it. When I compile the cmake project, I get an error:
Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: '../../../lib/vc_lib/mswd/wx/setup.h': No such file or directory F:\pgbuild\pgAgent-3.4.0\CMakeLists.txt F:\pgbuild\wxWidgets\include\msvc\wx\setup.h 123
There are lots of urls around the problem on the net, but I cannot get a handle on it.
It looks to me that this code needs to be updated:
#ifdef wxSUFFIX
#define wxSETUPH_PATH \
wxCONCAT6(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, wxSUFFIX, /wx/setup.h)
#else // suffix is empty
#define wxSETUPH_PATH \
wxCONCAT5(../../../lib/, wxLIB_SUBDIR, /, wxTOOLKIT_PREFIX, /wx/setup.h)
#endif
I built wxWidgets using wx_vc15.sln in F:\pgbuild\wxWidgets\build\msw. I was trying to build pgAgent as CMake project, although the building instructions say that I need to use the GUI version of CMake.
I was following instructions to build pgAdmin, but now I am wondering whether I need to build pgAdmin (don't mix it up vs. pgAgent) at all.
Any suggestions how?
Update:
I installed CMake for Windows and created a solution file to F:/pgbuild/pgAgent-3.4.0/build. Got some errors lines back:
Then clicked on configure, then on gnerate. This created the visual studio project file. Tried to build it, got the error above (wx/setup.h: No such file or directory). The exact error is
Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: '../../../lib/vc_dll/mswd/wx/setup.h': No such file or directory pgagent f:\pgbuild\wxwidgets\include\msvc\wx\setup.h 123

OpenCV error in Visual Studio 2010: fatal error LNK1104: cannot open file 'opencv_calib3d243.obj'

I have installed OpenCV 2.4.3 on Windows 7-64 bit. I am using Visual Studio 2010. OpenCV is installed in c:/opencv. I have added the environmental variables and all the necessary library dependecies. But, I always get this error :
fatal error LNK1104: cannot open file 'opencv_calib3d243.obj'.
The settings for VS2010 linker options is like below:
Additional Library Directories: C:\opencv\build\x64\vc10\lib
Additional Dependencies: I have listed all the libraries available in
the directory mentioned above.
But when I run I get that error. This library actually exists in the mentioned directory, but I don't know why I get this error. I have seen some other people ask similar questions, but none of the solutions could solve my problem.
use dependency walker tool to make sure u have all necessary dlls & libs loaded...
'opencv_calib3d243.obj' != 'opencv_calib3d243.lib' !
it should be 'lib', but you probably typed 'obj' there (which does not exist), look at it again.
Go to Project properties ->Configuration Properties -> Linker -> Input -> Additional Dependencies
In additional dependencies add
opencv_core243.lib
opencv_imgproc243.lib
opencv_highgui243.lib
opencv_ml243.lib
opencv_video243.lib
opencv_features2d243.lib
opencv_calib3d243.lib
opencv_objdetect243.lib
opencv_contrib243.lib
opencv_legacy243.lib
opencv_flann243.lib
If you have already added , make sure you have added opencv_calib3d243.lib
had the same problem, except VS was complaining about opencv_.obj instead, (I'm running it under visual studio 2010 express)
Fixed it by copying and pasting the lib dependencies from the provided "opencv_example" example (Project properties->linker->Input:Additional Dependencies).
So for convenience, I have this value in my Additional Dependencies:
opencv_core246d.lib;opencv_imgproc246d.lib;opencv_highgui246d.lib;opencv_ml246d.lib;opencv_video246d.lib;opencv_features2d246d.lib;opencv_calib3d246d.lib;opencv_objdetect246d.lib;opencv_contrib246d.lib;opencv_legacy246d.lib;opencv_flann246d.lib;%(AdditionalDependencies)
Note I: I'm running version 246, so you may have to adjust these names to reflect your installed version which appears to be 243
Note II: I'm compiling for debug, haven't tried release, but you should remove the trailing 'd' from the lib name for correctness.

Trouble building Boost Libraries

OS: Win7
IDE: Visual Studio 2010 Professional
Boost Lib Version: 1.47
Downloaded "boost_1_47_setup.exe" installer from http://www.boostpro.com/download/
Initially installed everything for VS 10, then just checked every box (5+ GB install!)
Added the "boost\boost_1_47" path into "Additional Include Directories" in C++->General
Copy/Pasted code from "Getting Started on Windows: 4 - Build a Simple Program Using Boost"
Compiled without issue
Included boost/regex.hpp and re-compiled
Received Error:
LINK : fatal error LNK1104: cannot open file 'libboost_regex-vc100-mt-gd-1_47.lib'
Expected, haven't built the binaries yet.
Ran "Visual Studio Command Prompt" from tools folder in my VS 10 installation as admin
cd'ed to boost root
Ran bootstrap.bat from command line
Received Error:
Building Boost.Build engine
The system cannot find the path specified.
'.\build.bat' is not recognized as an internal or external command,
operable program or batch file.
Failed to build Boost.Build engine.
Please consult bootstrap.log for furter diagnostics.
Everything I did came from the Getting Started page on Boost.org. Not sure if its just dated or if I'm doing something wrong.
Came here looking for answers, found some similar issues, namely the following:
Problem with C++ Boost installation (can't find file) in VC++ 2010
Problem with C++ Boost installation (can't find file) in VC++ 2010
Boost C++ Libraries linker error libboost_serialization-vc100-mt-gd-1_47.lib
Boost C++ Libraries linker error libboost_serialization-vc100-mt-gd-1_47.lib
No dice. Any help would be appreciated. Thanks
The compiler cannot find the BOOST's library file. To fix the issue you have to find on your computer the libboost_regex-vc100-mt-gd-1_47.lib file and add its folder path to the Project->YourProjectName Properties (Alt+F7)->Configuration Properties->Linker->General->Additional Library Directories. After recompile your project.
This is the answer to the above comment of #Johnny 5....thousand. In VS10 the compiler-wide additional libraries are deprecated. I solved the problem by adding a new project property sheet to all my projects. It is possible to do it by calling the Property Manager Tab (View->Property Manager). In the Property Manager Tab is necessary to click right mouse button on the project, select Add New Project Property Sheet, Save the sheet to a well-known place. After to define a new User Macro - Name:BOOST, Value: Your Boost Path, for example c:\boost_1_47_0\, also add the $(BOOST) to the Additional Include Directories and ad the $(BOOST)\lib to the Additional Library Directories. That's all. For all other projects is required to add existing property sheet.

Building Qt for Visual Studio 2010 - cannot open file 'qtmaind.lib'

I'm trying to start a C++ Qt application and have it run and compile in Visual Studio 2010.
Doing some googling, I found that there was a Visual Studio Qt Add-in, and so I installed this. I already had a MinGW Qt binary installed, and when this did not work, I found that you have to compile the source for Visual Studio 2010 (the VS 2008 binary will cause deployment issues).
Using this as a guide: How to build Qt for Visual Studio 2010, I compiled the open source version, and added it to the PATH, along with a QTDIR env variable. Hoping that I got it finally working, I created a "Qt Application" using the New Project Wizard in Visual Studio 2010. Once I finished, I tried to build the program, only to see the following error:
1>LINK : fatal error LNK1104: cannot open file 'qtmaind.lib'
I looked in the C:\QT\lib folder, and found that I only have a qtmaind.prl, but no clue as to why there is no qtmaind.lib.
I am able to echo the QMAKESPEC environmental variable to get a 'win32-msvc2010' output.
I've tried several different combinations of flags for the configure step, including the one in the link, and even tried manually setting the -platform flag.
If anyone can offer any help, it would be greatly appreciated! :D
Just ran across this same problem. I changed the "-release" flag from the linked guide to "-debug-and-release", and then it built the qtmaind.lib library (presumably, that "d" suffix stands for debug).
I encountered this issue when running a project whose settings were hardcoded for a particular machine setup.
I could see that the vcxproj file had something like:
C:\Qt\4.8.1\libqtmaind.lib
I could not find this lib file in my machine. I replaced the line by:
C:\Qt\4.7.3\lib\Qtmaind.lib
It looks like the names of library files are different across Qt versions.Or, maybe the library files were renamed.
Also, the 'd' denoted debug. If you cannot find any lib file post-fixed by 'd', it is likely that you did not 'make' a debug version of Qt.
You can cross check this by opening the .Sln file created by configure. Mine was named Projects.sln. You can open this in notepad and see if win32-debug configurations are present.
This might be a QMAKESPEC issue. Try setting your QMAKESPEC environment variable to
win32-msvc2010
and rebuild Qt like that. This should give you .lib files in your Qt folder
in QT 5.3 with vs 2013
in properties -> linker -> input
remove ANY path for qt libraries such qtmaind.lib
this is known BUG

Boost Include Files in VC++

For the last few years, I have been exclusively a C# developer. Previously, I developed in C++ and have a C++ application that I built about 3 years ago using VS2005. It made extensive use of the Boost libraries. I recently decided to brush off the old app and rebuild it in VS2008 with the latest version of Boost (the latest version with the "easy" installation program from BoostPro Computing), 1.39. Previously when I had the program running I was at 1.33. Also, the last time the program was running was at least 2 OS installations ago. The Boost installation is located on my machine at: "C:\Program Files\boost\boost_1_39". Anyway, I have done the following:
Set the project's "Additional Include Directories" directory to "C:\Program Files\boost\boost_1_39"
Added "C:\Program Files\boost\boost_1_39" to VS2008's Tools - Options - Projects and Solutions - VC++ Directories - Include Files
I have a number of Boost includes in my stdafx.h file. The compiler fails upon attempting to open the first one - #include <boost/algorithm/string/string.hpp>
I have confirmed that the above file is indeed located at "C:\Program Files\boost\boost_1_39\boost\algorithm\string\string.hpp"
I continue to get: fatal error C1083: Cannot open include file: 'boost/algorithm/string/string.hpp': No such file or directory
Any tips on what else to check would be greatly appreciated.
Again, this is an application that compiled fine a few years ago, but the source has now been moved to a new machine/compiler.
You can open your .vcproj and .sln files in a plain text editor and do a search-and-replace on the old paths to correct them. Much easier than digging through the IDE settings.

Resources