Boost Libraries and Visual Studio 2013 - c++

I have installed boost using MSVC toolset through command-line(command prompt).
Now, I want to know which directories should I include in my project properties.
Since when I add the following line to my project:
#include <filesystem\fstream.hpp>
It throws the following error:
1>c:\boost\boost_1_56_0\boost\filesystem\fstream.hpp(15): fatal error C1083:
Cannot open include file: 'boost/config.hpp': No such file or directory
I have added the followings to my project properties directories for libraries:
C:\boost\boost_1_56_0\boost
C:\boost\boost_1_56_0\stage\lib
This is where I have added the above paths:
(Project->Properties->VC++ Directories->Library Directories

Don't add the boost subdirectory to the search path; add the parent
C:\boost\boost_1_56_0
and specify the boost directory when you include the headers
#include <boost/filesystem/fstream.hpp> // Better to use / not \ for portability
The Boost headers include each other like that (with boost/ in the path), so now they can also be found.

Related

Dlib Error: error C1083: Cannot open include file:'type_safe_union/type_safe_union_kernel.h'

I'd like to use the image processing package of Dlib (C++ library) in Visual Studio 2013.
I created an empty project and added "dlib-18.16\dlib\all\source.cpp" to my Source Files in the Solution Explorer. Then, I added the path to dlib-18.16 to my Include Directories in VC++ Directories and I also added the path to dlib-18.16\dlib to my Additional Include Directories in C/C++ General of Visual Studio.
I can run the file matrix_ex.cpp which is one of the examples of Dlib, but I can't run the file face_detection_ex.cpp because of the error " Cannot open include file:'type_safe_union/type_safe_union_kernel.h' " which is actually caused by the line #include <dlib/image_processing/frontal_face_detector.h>
How can I resolve this issue? Why the program finds some header files but it can't find the others while they are all located in the same folder?
You need to add the dlib folder itself to the Include Directories in VC++ Directories, you instead added the folder above it.
By extension that would mean your include directive needs to be #include <image_processing/frontal_face_detector.h>.
Let me list a hypothetical example to explain better. You downloaded dlib-18.16.tar.bz2 and extracted it to c:\projects. This creates a folder named c:\projects\dlib-18.16. Within VC++ Directories you added c:\projects\dlib-18.16 to the Include Directories.
However this isn't correct, you should remove that directory and instead add c:\projects\dlib-18.16\dlib as that is the include directory for the project.
That will cause #include <type_safe_union/type_safe_union_kernel.h> to load C:\projects\dlib-18.16\dlib\type_safe_union\type_safe_union_kernel.h as well as similar internal links between files.

How to add a header file in Visual Studio 2013, C++

I use Visual Studio 2013 to build a program. I have got some problems...
a) an error:
c:\users\wojciech\desktop\cryingdamson 0.3.6 (8.60) v8.2 source\otpch.h(28): fatal error C1083: Cannot open include file: 'libxml/xmlmemory.h': No such file or directory
My code:
#include <libxml/xmlmemory.h>
I have included that file in Visual Studio 2013 to header files and I have even it at libxml folder. I can not still build solution (compile) because of that error.
Please help me, I am new to Visual Studio. I have tried to add xmlmemory.h file to project properties, but it seems that it doesn't see the file.
Okay, in folder "c:\users\wojciech\my documents/visual studio 2013/projects/consoleapplication3" there is a file named MainProject.sln, which type is microsoft visual solution. In the same folder I have added libxml folder and in the folder I have put xmlmemory.h. The problem is I still can not compile the program.
I use windows 7.
You Need to add the parent Folder of libxml to the include path. Say if the Folder structure Looks like
some_project
include
libxml
xmlmemory.h
...
you Need to add the include Directory to the include path
Where is your xmlmemory.h? Of #include <.../libxml/xmlmemory.h> try a complete path in the ... part.
The path libxml/xmlmemory.h is in fact ./libxml/xmlmemory.h where ./ means the location of your workspace.
===============Next is added according to your comment==========================
Just using #include "..\libxml\xmlmemory.h" would compile. So your workspace path is therefore c:\users\wojciech\my documents/visual studio 2013/projects/consoleapplication3. Under your workspace there should be a folder MainProject where your existed source files are located. So .\ means the path c:\users\wojciech\my documents\visual studio 2013\projects\consoleapplication3\MainProject.
Note that you should use \ other than / to represent your file hierarchy in your project and that you should use "xxx.h" other than <xxx.h>.
You can also use this method: open VIEW->Property Manager, right click on MainProject and open Properties, in C/C++ -> General -> Additional Include Directories, add your folder libxml to it. Then all files under your libxml folder would become a part of your solution. You can just use #include "xmlmemory.h>" to make it compile.
Either way is supposed to compile.

How to include a lib with dependencies to QT

I am creating a Visual C++ sample project where i need to include a third party library.
I added the lib and added the include directory.
But my problem is now, that the header files of the library have the following line in their header files:
#include <QtCore/QVector>
and the compiler error is:
error C1083: Cannot open include file: 'QtCore/QVector': No such file or directory
I have the used dlls, but I am stuck how to include them?!
I solved it with installing Qt locally and adding it to the PATH.

Using tclap-Templatized C++ Command Line Parser Library in Visual Studio2010

Is tclap-Templatized C++ Command Line Parser Library installable on windows? I want to use this library in my code in Visual Studio2010. I did following steps:
1. add the "..\include" in Property->C/C++->General-> Additional Include Directories
2. copy include folder in my project folder.
3. add #include in my main file.
But I have following error during compile
fatal error C1083: Cannot open include file: 'tclap/CmdLine.h': No such file or directory
use an absolute path in the "Additional Include Directories" setting, and make sure that it applies to your configuration as well. Don't go around copying folders in projects all willy and/or nilly, that just makes life harder. If the tclap directory is correctly added to your system include path, then #include will work; if that doesn't work, your system include path is not set correctly.
In more recent versions of VC, you will want to make sure that these settings are set in the appropriate properties files in the Properties explorer.

Linking tesseract libs

I'm having trouble using tesseract.
I've downloaded the source code and compiled successfully.
Then I created a project in VC++ and I'm trying to do the first steps.
I created a simple program and included
#include <baseapi.h>
On project properties -> Linker -> Additional Dependencies i`ve put all the libs that tesseract generated
ccmain.lib ccstruct.lib ccutil.lib classify.lib cube.lib cutil.lib dict.lib image.lib libtesseract_tessopt.lib libtesseract_training.lib neural_networks.lib textord.lib viewer.lib wordrec.lib
I also set the path of libs on Additional Libraries Directories. It seems to recognize the libs. But the problem is that i`m getting the following error:
fatal error C1083: Cannot open include file: 'baseapi.h': No such file or directory
Can anyone help me? I`m just starting and it is difficult.
As an update, I've set the paths and included the files on my solution. But I'm getting different errors on ccutil.h.
*fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory *
Due to this code
#ifdef WIN32
#include <windows.h>
#else
#include <pthread.h>
#include <semaphore.h>
#endif
On your project you need to add the path to the tesseract headers in "Additional Include Directories".