OpenCV installation Problems with Visual Studio 2013 - c++

I have installed OpenCV 2.4.8 with Visual Studio 2013 using instruction found all over the Internet. I modified the property sheets and everything, but I am still facing a problem with the installation. When I try to run a test program, it gives me the following error:
Cannot open source file opencv2/core/core.hpp
Cannot open source file opencv2/highgui/highgui_c.h
Why does this error occur? I have followed all installation steps faithfully.
Although, I should point out one more thing: There weren't any instructions for VS 2013, but only for VS 2012, so I just modified it where it was necessary, like replacing vc11 with vc12.

Make sure that you have openCV directory in your project's include directory. You should add openCV's include directory not include\opencv2.
Can you give me your project's include inputs?

I think this is not opencv installation issue. Make sure the include opencv path is correct in your solution.
You need to add correct header include paths and library paths in the red marked area for your project. Also after including that try to open the header files(opencv header files) from the solution using right mouse click "Open Document "something.h" " to make sure your included path is correct.

Related

code execution cannot proceed because cpprest_2_10.dll was not found

My aim is to use the Rest API in Visual Studio.
I downloaded the C++ tool vcpkg from https://github.com/Microsoft/vcpkg and followed the instructions on https://github.com/Microsoft/cpprestsdk to install cpprestsdk. That worked fine.
Then, in Visual Studio in the properties of the solution explorer, I included the following paths from the vcpkg folder into "VCC++ Directories->Include directories":
vcpkg-master\vcpkg-master\buildtrees\cpprestsdk\src\v2.10.2-718a4e55e9\Release\include\cpprest
vcpkg-master\vcpkg-master\buildtrees\cpprestsdk\src\v2.10.2-718a4e55e9\Release\include
vcpkg-master\vcpkg-master\buildtrees\cpprestsdk\src\v2.10.2-718a4e55e9\Release\include\pplx
Then I run my code and the following errors occur:
LNK2001 unresolved external symbols (32 errors like this)
I googled it and was told to include the respective ".lib"-files into "Properties->Linker->Input->Additional Dependencies" and to include the paths of the corresponding ".dll"-files into "Properties->Linker->General->Additional Library Directories", what I did.
Now, running the code again, just the following error occurs:
code execution cannot proceed because cpprest_2_10.dll was not found. Reinstalling the program may fix the problem,
although the "cpprest_2_10.dll" is in the path, which I included previously.
I have no idea what the problem is. Thank you in advance for your time.
Try to put the missing dll file right to the directory of your compiled exe.
Or check this answer to set a path so your binary can find the dll file:
How do I set the path to a DLL file in Visual Studio?

Visual Studio 2013 cannot open 'glfw3.lib'

I'm having a few issues getting GLFW3 set up. I've downloaded the 64-bit binaries from the official site, added glfw3.dll, glfw3.lib and glfw3.h to their respective places, specified the proper include, and added the appropriate linker input to my project. However, when I test the library with glfwInit(), VS spits this out:
error LNK1104: cannot open file 'glfw3.lib' Path/To/Project
My guess was that VS didn't know what directory the library was in, but seeing as it's in the IDE's own lib folder, I don't think this is it. Does anyone have any suggestions? Sorry if this has already been solved, I got in as deep as to read the steps of compilation before I gave up searching.
Edit: I also changed the solution platform to x64, since I am using the 64-bit GLFW binaries.
Following Andon M. Coleman's advice, I moved the headers and library folders to a new directory outside of Visual Studio's built-in ones (D:\opengl-wrappers\lib & D:\opengl-wrappers\include, for example). After including those libraries in the project settings (C/C++->General-> Additional Include Directories and Linker->General->Additional Library Directories), everything compiled beautifully.

OpenCV 2.4.8. Installation from source does not contain \Build\x64\vc10

I'm running into trouble when trying to use OpenCV 2.4.8 in Visual Studio 2010. I've built OpenCV from source since i'll be needing CUDA functionality.
When arriving at the step to add the path to the environment variable as indicated here: http://docs.opencv.org/doc/tutorials/introduction/windows_install/windows_install.html#windowssetpathandenviromentvariable, it seems \Build\x64\vc10 is not present in my OpenCV folder. Instead, I've simply added C:\OpenCV\build as OPENCV_DIR to my environment path, since it seems lib and bin are present in this folder.
However, adding $(OPENCV_DIR)....\include to my Visual Studio 2010 project, as indicated here: http://docs.opencv.org/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html#windows-visual-studio-how-to will yield unwanted results, as this will point to my C:\ drive, instead of the OpenCV root folder. My OpenCV root folder does have an include folder, however it does not seem to contain relevant files (some files related to CMake).
Long story short, it seems I'm unable to add OpenCV to Visual Studio 2010 if OpenCV is built from source.
Can anybody see what I'm missing here?
Any help is greatly appreciated.
The instructions assume you are using the prebuilt binaries that come with OpenCV. If you build it yourself (as in your case), you have two options:
Set CMAKE_INSTALL_PREFIX when building opencv and run the INSTALL target to put all of the OpenCV files you need in known place that works for you. Set OPENCV_DIR to this installed location (i.e. C:\libs\opencv), and set the include directory to $(OPENCV_DIR)\include.
set OPENCV_DIR to the build directory (as you've done), but when setting the include directory only go up one directory: $(OPENCV_DIR)..\include; this will point to the include directory in the original source location

Visual Studio not using additional include directories for KinectBridgeWithOpenCVBasics D2D C++ Sample, but does for other solutions.

I'm working on adding some openCV features to a couple projects that use the Kinect and openGL/freeGLUT. I have downloaded and installed OpenCV using the pre-built libraries and successfully run a simple sample. Now I want to work with the Kinect Bridge with OpenCV Basics sample from the Kinect for Windows Developer Toolkit to get a better idea of how to use OpenCV with the Kinect. I downloaded the sample into my projects folder, opened the solution in visual studio and built it. I got the following errors:
Error 1 error C1083: Cannot open include file:
'opencv2/core/core.hpp': No such file or
directory c:\users\justin\documents\visual studio
2010\projects\kinectbridgewithopencvbasics-d2d\OpenCVHelper.h 17
and
Error 2 error C1083: Cannot open include file:
'opencv2/core/core.hpp': No such file or
directory c:\users\justin\documents\visual studio
2010\projects\kinectbridgewithopencvbasics-d2d\OpenCVFrameHelper.h 13
Initially I thought these errors were due to forgetting to specify the additional include directories. I added the same property sheet that my other OpenCV projects use to this one, but the errors remained. I tired copying the header files into the project folder: same thing. It seems like the only thing that works is specifying the full absolute file paths in the #include statements. I want to avoid doing this because visual studio wants me to change every #include in every file used in the project, including the openCV header files. I also tried shortening the name of my project folder in case the file path was too long (though I'm pretty sure that's more of an issue for the header file paths), but again no change.
The include directories and #includes that I'm trying to use are the same as in my other projects. I'm using Visual Studio 2010 on Windows 7 x64 based system.
Why would the additional include directory work for other projects, but not this one?
Usually when I see something like this it turns out to be a bad character in one of the prior include paths or other options that's messing everything up after it. I would take a look at your the command line page in the project configuration and see if you can spot anything amiss.

Visual Studio 2010 Assimp library won't link

I seem to have a perpetual problem of never being able to get any library to link with Visual Studio. Ever. I eventually get tired of trying and just include the header and source files manually.
My latest endeavour is trying to set up Assimp. I went and downloaded the latest version and followed the installation guide for Visual Studio 2010. http://assimp.sourceforge.net/lib_html/install.html
The result:
LINK : fatal error LNK1104: cannot open file 'assimp--3.0.1270-sdk/lib/assimp_release-dll_x64/assimp.lib'
I set the include directories:
assimp--3.0.1270-sdk/include
I set the library directories:
assimp--3.0.1270-sdk/lib/assimp_release-dll_x64
I set the additional dependencies (the guide includes the directories, but shouldn't I just be able to just put assimp.lib since I included the library directory above?):
assimp--3.0.1270-sdk/lib/assimp_release-dll_x64/assimp.lib
What am I doing wrong?
Also, considering this isn't my first time having these difficulties, are there any good tutorials to help me understand this process a little better? I've tried searching for it but most are for previous versions of VS...
My guess is you should provide explicitly relative or absolute paths for the library directory.
You're right about the dependency name, assimp.lib is the correct name and the guide is a bit ambiguous here.
Apart from that, you're doing everything right. Provided the lib file exists, it should link.
(assimp co-founder writing here)