Using crypto++ library with MSVS 2013 [duplicate] - c++

I started with learning C++ a few days ago and I would like to get some data to make it more funny. I found a powerful C++ library called Unirest that can help me to get data from many APIs and after practice the basics :)
I don't know how to include libraries into my project. I fond some videos about how to do it so I just created libs folder (like i always do when I'm programming in PHP) and I copied library files. After I included header file UNIRest.h into my source and added the libs directory into VS+ Directories option in Project Properties - Configuration Properties - VC+ Directories. Everything is still OK. But when I opened the header file UNIRest.h the problem appeared:
#import "UNIHTTPRequest.h"
#import "UNIHTTPRequestWithBody.h"
#import "HttpRequest/UNISimpleRequest.h"
#import "HttpRequest/UNIBodyRequest.h"
#import "HttpResponse/UNIHTTPBinaryResponse.h"
#import "HttpResponse/UNIHTTPJsonResponse.h"
#import "HttpResponse/UNIHTTPStringResponse.h"
All of those macros are underlined and compilation failed with message:
fatal error C1083: Cannot open type library file: 'libs\unirest\unihttprequest.h': Error loading type library/DLL.
Could you please help me? Hope it's not just a stupid question because I tried to make it works whole afternoon :(

Typically you need to do 5 things to include a library in your project:
1) Add #include statements necessary files with declarations/interfaces, e.g.:
#include "library.h"
2) Add an include directory for the compiler to look into
-> Configuration Properties/VC++ Directories/Include Directories (click and edit, add a new entry)
3) Add a library directory for *.lib files:
-> project(on top bar)/properties/Configuration Properties/VC++ Directories/Library Directories (click and edit, add a new entry)
4) Link the lib's *.lib files
-> Configuration Properties/Linker/Input/Additional Dependencies (e.g.: library.lib;
5) Place *.dll files either:
-> in the directory you'll be opening your final executable from or into Windows/system32

In code level also, you could add your lib to the project using the compiler directives #pragma.
example:
#pragma comment( lib, "yourLibrary.lib" )

Related

2 projects dependency in same solution causes unresolved symbol [duplicate]

I started with learning C++ a few days ago and I would like to get some data to make it more funny. I found a powerful C++ library called Unirest that can help me to get data from many APIs and after practice the basics :)
I don't know how to include libraries into my project. I fond some videos about how to do it so I just created libs folder (like i always do when I'm programming in PHP) and I copied library files. After I included header file UNIRest.h into my source and added the libs directory into VS+ Directories option in Project Properties - Configuration Properties - VC+ Directories. Everything is still OK. But when I opened the header file UNIRest.h the problem appeared:
#import "UNIHTTPRequest.h"
#import "UNIHTTPRequestWithBody.h"
#import "HttpRequest/UNISimpleRequest.h"
#import "HttpRequest/UNIBodyRequest.h"
#import "HttpResponse/UNIHTTPBinaryResponse.h"
#import "HttpResponse/UNIHTTPJsonResponse.h"
#import "HttpResponse/UNIHTTPStringResponse.h"
All of those macros are underlined and compilation failed with message:
fatal error C1083: Cannot open type library file: 'libs\unirest\unihttprequest.h': Error loading type library/DLL.
Could you please help me? Hope it's not just a stupid question because I tried to make it works whole afternoon :(
Typically you need to do 5 things to include a library in your project:
1) Add #include statements necessary files with declarations/interfaces, e.g.:
#include "library.h"
2) Add an include directory for the compiler to look into
-> Configuration Properties/VC++ Directories/Include Directories (click and edit, add a new entry)
3) Add a library directory for *.lib files:
-> project(on top bar)/properties/Configuration Properties/VC++ Directories/Library Directories (click and edit, add a new entry)
4) Link the lib's *.lib files
-> Configuration Properties/Linker/Input/Additional Dependencies (e.g.: library.lib;
5) Place *.dll files either:
-> in the directory you'll be opening your final executable from or into Windows/system32
In code level also, you could add your lib to the project using the compiler directives #pragma.
example:
#pragma comment( lib, "yourLibrary.lib" )

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.

Linker error when using cuSolver [duplicate]

I started with learning C++ a few days ago and I would like to get some data to make it more funny. I found a powerful C++ library called Unirest that can help me to get data from many APIs and after practice the basics :)
I don't know how to include libraries into my project. I fond some videos about how to do it so I just created libs folder (like i always do when I'm programming in PHP) and I copied library files. After I included header file UNIRest.h into my source and added the libs directory into VS+ Directories option in Project Properties - Configuration Properties - VC+ Directories. Everything is still OK. But when I opened the header file UNIRest.h the problem appeared:
#import "UNIHTTPRequest.h"
#import "UNIHTTPRequestWithBody.h"
#import "HttpRequest/UNISimpleRequest.h"
#import "HttpRequest/UNIBodyRequest.h"
#import "HttpResponse/UNIHTTPBinaryResponse.h"
#import "HttpResponse/UNIHTTPJsonResponse.h"
#import "HttpResponse/UNIHTTPStringResponse.h"
All of those macros are underlined and compilation failed with message:
fatal error C1083: Cannot open type library file: 'libs\unirest\unihttprequest.h': Error loading type library/DLL.
Could you please help me? Hope it's not just a stupid question because I tried to make it works whole afternoon :(
Typically you need to do 5 things to include a library in your project:
1) Add #include statements necessary files with declarations/interfaces, e.g.:
#include "library.h"
2) Add an include directory for the compiler to look into
-> Configuration Properties/VC++ Directories/Include Directories (click and edit, add a new entry)
3) Add a library directory for *.lib files:
-> project(on top bar)/properties/Configuration Properties/VC++ Directories/Library Directories (click and edit, add a new entry)
4) Link the lib's *.lib files
-> Configuration Properties/Linker/Input/Additional Dependencies (e.g.: library.lib;
5) Place *.dll files either:
-> in the directory you'll be opening your final executable from or into Windows/system32
In code level also, you could add your lib to the project using the compiler directives #pragma.
example:
#pragma comment( lib, "yourLibrary.lib" )

Visual Studio Additional Include Paths?

I'm working on an existing Visual Studio 12 "Solution" from another team..
In one of its "project"s,, there's a header file that includes a file from another static library projecet..
So Lets say the solution structure looks something like this:
Project A (Static Library Project)
\__ someFile.h
Project B (Static Library Project)
\__ someLibrary.h
In someFile.h,
...
#include "someLibrary.h"
...
and this loads the library successfully.. BUT this is strange because the path to someLibrary.h is NOT SPECIFIED anywhere in Project A's settings!!
I've checked Configuration Properties => VC++ Directories => Include Directories but path to someLibrary.h is NOT specified here..
Since Project A is a static library with NO cpp files (has only header files), It does not have a Configuration Properties => C++ => Additional Include Directory Option at all... (It only has the Librarian option)
And of course someLibrary.h is not in the same directory as someFile.h.
Finally, in Project A's Common Properties, Project B is not referenced either...
So my question is : How the hell does someFile.h know where someLibrary.h is?
How is it including it??
Is there any other places in project settings/etc where additional include directory can be specified..?
UPDATE:
when I right click on the #include statement and click "Open Document 'someLibrary.h'",
I do see a following VS error box:
File 'someLibrary.h' not found in current source file's directory or in build system paths.
Nevertheless,, there is NO build error, and Project A uses someLibrary.h with no problem!!

Additional Include Directories Difficulties

I'm trying to include the FTGL library into my graphics project, but I keep getting c1083 error whenever I try to include the main header file:
#include <include/FTGL/ftgl.h>
I have added the path $(Project1)include\FTGL to "Additional Include Directories" and VC++ Include Directories to no avail. Project1 is the main solution folder and "include" is the folder where the headers for glew and whatnot are.
What am I doing wrong? Thanks for the help.
The rules here are very simple. Say you have a file on your hard drive:
C:\abc\def\include\FTGL\ftgl.h
Then you need to add an include path C:\abc\def to your project and the include statement:
#include <include/FTGL/ftgl.h>
This was tested 1000 times. Works fine! Once you will make this working, start experimenting with $(Project1) and other VS variables.