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

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.

Related

Boost Library cannot get to work in C++, Include directories not working

I recently tried to install boost libraries in C++ 14, and I added it's include paths like:
Solution Explorer > Project Name > Property Pages > VC++ Directories > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\boost\boost"
I tried to compile after adding this:
#include <boost\variant.hpp>
In Error List window, I can see E1696 - cannot open source file "boost\variant.hpp" and I can't compile like before.
Then I tried with adding a backslash like "C:\Program Files (x86)\Microsoft Visual Studio 14.0\boost\boost\", still didn't work.
I also read this post and explicitly specified it's directory, but even didn't work.
Again, I read this post and did exactly same what is in given answer (as I already built project several times) , but still no success.
However, if I include a library like:
#include "C:\Program Files (x86)\Microsoft Visual Studio 14.0\boost\boost\variant.hpp"
Now compiler recognizes it, but now I can see more than 100 errors in Error List window, those errors are pointed to header files of boost libraries, not in my project file which has variant.hpp included.
All those errors are E1696 - cannot open source file "boost\<libraryname.hpp>" or E1696 - cannot open source file "boost\<subdirs>\<some other files included in libraryname.hpp>"
So, if I remove the line #include "C:\Program Files (x86)\Microsoft Visual Studio 14.0\boost\boost\variant.hpp" from my project's header file, all errors disappear suddenly and project compiles fine! no any single error now!
I want boost to work anyway, so I can use it in projects, but I can't manually edit all those header files and change <boost\... to original locations.
Please help me to get rid of this issue.
make sure you download and install the correct boost version. Installing it in the visual studio directories is possible, but not advised. I suggest you use one of the packages from here. Assuming you use visual studio 2017 and you are developing for 64bit, this could perhaps be the correct package for you.
make sure you do both: adding the include search path and the library search path to your visual studio.
The include search path should point to the boost-installation root directory (the one that contains the Jamroot file and a boost subdirectory). The library search path should point to the correct library subfolder within the boost installation. This is one of the subfolders that start with lib64-msvc-**.* (or lib32-msvc-* if you're developing for 32bit).
The default install path of the binary boost package above will install it into C:\local\boost_<boost version>. Make sure you use the paths from this installation directory and follow the instructions here.
Example:
Include search path: C:\local\boost_1_64_0
Library search path: C:\local\boost_1_64_0\lib64-msvc-14.1

OpenCV installation Problems with Visual Studio 2013

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.

fatal error: sal.h: No such file or directory

I know that there are other errors for certain header files with the same message of "No such file or directory", but my circumstances are a bit different as I will explain now.
I use the Code Blocks IDE and wanted to start using the UI Automation library. When I tried to include the header
#include UIAutomation.h
Code Blocks could not find the header. From there I looked around my computer and saw that the UIAutomation.h, UIAutomationCore.h... and the other UIAutomation headers were in an "Include" file in the "Microsoft SDKs" folder.... So I went to (Settings -> Compiler -> Search directories) and in there I added a new directory to the include folder where the UI Automation headers were:
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include;
and Code Blocks found the headers. However... another error appeared:
fatal error: sal.h: No such file or directory
and I searched for the sal.h in the "\Include" folder I had just written code for and there was no sal.h file. I understood everything up until here... I had to check if I had a sal.h folder somewhere else on my computer and I did, in a file somewhere in my Visual Studio 10 IDE folders (just to let u guys know, I use code blocks cause I have been using it for a long time, and only downloaded VS10 recently to use spy++). So then I thought ok... I'll do the same thing I did before again so that I can include those files too, so I go back into the Search directories section and add the directory:
C:\Program Files\Microsoft Visual Studio 10.0\VC\include
but from there a million different errors appeared, all refereeing to different issues. Can anyone tell me what I did wrong? All I wanted to do was use the UI Automation headers so that I can start coding with the library, but that is proving to be a bit difficult...
From what one can get from this related Q&A: 'How do I get sal.h' it's not possible to use this stuff with a different toolchain than MSVC (Visual Studio).
You may consider to configure MSVC as toolchain for this codeblocks project.

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)

Visual Studio 2010, C++, Cannot open include file: 'base.h'

I'm trying to build a project in Visual Studio 2010. But I get the following error:
fatal error C1083: Cannot open include file: 'base.h': No such file or directory
This is a part of the code from (stdafx.h) generating the error:
// from Base project
include "base.h"
include "basic.h"
include "logfile.h"
It seems that the project uses "MFC Microsoft Office Fluent User Interface (the "Fluent UI")".
Do I have to install anything else than Visual Studio for using it?
Something that is missing, that generates the error?
I'm quite new to C++ and Visual Studio.
EDIT:
The problem is that I can't find the files: // from Base project #include "base.h" #include "basic.h" #include "logfile.h" And I don't really know what they are for. I guess some MFC stuff? And they are not anywhere on my disk.
I'm using Windows 7, I don't know on which OS the project is developed on. Can it be that it's developed on WinXP for instance? In that case, do I need to install the SDK for WinXP?
The Fluency UI is part of a MSVC++ feature pack, which you will have to install on top of Visual Studio (you can dowload it following the links in the given page).
In particular the error is due to the fact that the compiler cannot find the file base.h, which could be because it is part of the above mentioned feature pack (and thus it is currently missing) or (if the file does exist on your computer) because your include path (the path the compiler consults for finding included files) is set up incorrectly
Make sure base.h available in the working directory
Right click the base.h (From code editor) and click open document in the context menu (first menu item)
Search that file in your project root folder, then make sure that the path for the file is available in the additional include directory. Project property page --> Select C/C++, first entry on the right side grid.
The problem with this was missing files in the project. Thanks for the help.