How do I add curlpp to my project? - c++

I'm trying to make a transition from vb.net to C++ and I'm stuck on this. I downloaded curlpp from here which got me a .dll, .exp and .lib file. I added the directory that contains those 3 files to "Additional Library Directories" in the project properties (Linker -> General).
Next, I added ws2_32.lib and Wldap32.lib to "Additional Dependencies", also in the project properties (Linker -> Input) because this question stated I should.
Now I'm trying to get Example 00 to work, but
#include <curlpp/curlpp.hpp>
#include <curlpp/Easy.hpp>
#include <curlpp/Options.hpp>
States "cannot open source file curlpp/curlpp.hpp" etc. which makes sense because I have never even seen those files. What am I doing wrong? This is quite different from vb.net and I can't seem to figure it out.
UPDATE:
I did what Mat said, but it didn't work, so I added all relevent folders to be sure.
But VS still states the files can't be found.

You should download the full source package (.tar.gz in the downloads section) to get the headers, code, samples and documentation.
You'll need to add the base directory where the include files reside on your machine (after unpacking the archive) to the list of include directories for your project.

Related

how to link Qt with a visual studio c++ application project?

I have Qt 5.12.0 in a folder.
I need to create a dll and/or a bin project that can connect with a QML program.
My problem is that the vs project can't find the Qt files I need.
#include <QGuiApplication>
does not work.
This topic is the continuity of this one
How to link libraries to a project on visual studio? where I shared my problems with linking my dll with my bin project and to link Qt.
So I use a batch file to set the environment variable before launching visual studio. I use these variables to get the path to the Qt include folder, Qt lib etc.
Here is what I tried.
include the directory that contains the headers I need (I guess) :
configuration properties -> C/C++ -> General -> other include directories ->$(QT_INC)/. QT_INC is the path to the include folder. I also tried to write $(QT_INC)/* and $(QT_INC)/QtGui/. In any case,
#include <QGuiApplication>
couldn't compile.
i also added the path to the library folder :
linker->General->Additional library directories->$(QT_LIB)/
and some lib files in :
linker->entry->additionnal dependencies->Qt5Quick.lib;Qt5Gui;lib;Qt5Core.lib
none of these steps creates any error. It just doesn't help to find QGuiApplication.h nor QObject or anything I need.
I know my paths are correct and that using the environment variable like this works as I linked my dll using this method, and because wrong paths generates errors.
How to add Qt to my solution or to a project ?
thanks in advance
It works. The path was incorrect. There were "/" instead of "\" I think. And a synthax error in the batch file.
It's possible to add the header files of Qt by including the path in the properties.
include just the directory include of the Qt folder. Then, include headers again and again until all the errors are gone.
only for QGuiApplication, I need to include this
#include <QtGui/qtguiglobal.h>
#include <QtGui/qcoreapplication.h>
etc. all the includes of the beggining of QGuiApplication.h actually
here is the link to my other post I made about linking Qt to visual studio. How to link libraries to a project on visual studio? The problem was about the path to the dll.

Using header files with multiple projects in same solution

I'm using C++ and visual studio 2015. I've created 2 projects in 1 solution. The first project is a static library and the other a DLL. I want to include one header file from the static library to use it in the DLL. I tried specifying the path to the header file with - Project->Properties->C/C++ -> General -> Additional include directories but it doesn't work. When I try to include the header file I get a red underline saying "cannot open source file "SomeHeaderFile.h".
Thanks for the help.
Thanks for the tips but I found out how to make it work. The DLL is in a extra folder. All I had to do was #include "../../TheHeaderFileThatISpentHoursTryingToGet.h". I deleted the reference in the additional include directories path and it still works. I always thought that it made sense for files from different projects in the same solution to be accessible throughout all the projects. Thanks again.

Having trouble when trying to include boost.serialization into my VS project

So i want to get Boost.serialization into my project but i just want that library from the boost package that you get. I built the boost thing so got i got access to the .lib files for the serialization library.
The ones i got are;
libboost_serialization-vc100-mt-1_55
libboost_serialization-vc100-mt-gd-1_55
libboost_wserialization-vc100-mt-1_55
libboost_wserialization-vc100-mt-gd-1_55
I took these and put them into a new folder and linked my VS project to these files to the additional lib directory.
I also took serialization folder from the boost package and put it in my include folder that is linked to my project.
When i now try to build my app i get these errors;
IntelliSense: cannot open source file "boost/config.hpp"
IntelliSense: cannot open source file "boost/operators.hpp"
IntelliSense: namespace "boost" has no member class "totally_ordered1"
How should i go about to fix these errors? Do i need to add all the .hpp files that the library wants or is there another way around this?
Thanks :)
You mentioned that you built boost and then moved some of the headers into your project. The latter is not advisable - leave the boost includes and libraries where you've installed them and built boost.
In Project ⇒ Properties ⇒ Configuration Properties, add
The toplevel boost directory to the Include Directories (eg., c:\boost)
The directory with the built boost libraries to the Library Directories (eg., c:\boost\lib)
If you still get IntelliSense errors after that add
The "$(ProjectDir)" to the Reference Directories

Issues with including headers from static library

I may be just missing something, but I'm trying to include a MongoDB C++ driver library build into my DLL project. I'm trying to follow this guide
I've tried including the folder in Configuration Properties->Linker->General->Additional Library Directories, and the .lib file in Linker->Input->Additional Dependencies. I've also added the /MT command-line option.
Now here comes my problem - how do I use the files? Do I just use #include "mongo/client/dbclient.h", because this doesn't seem to work (Cannot open source file). I can't find much of any helpful documentation on this subject.
Any ideas?

DLL References in Visual C++

I have had C++ experience but not MSVC.
What I am trying to do is incorporate a .dll from an open source project into my project. The code is available and I have built it. I have the .dll as well as the .lib which as I understand it is required for C++ projects.
Now unfortunately there is no simple "Add Reference", drop my .dll into an include directory and add that to my solution. I have edited the project property pages, the C/C++ Additional Include Directories option as well as adding the .lib as an additional linker dependency. I have created an include directory for the dll and lib inside my solution tree.
My problem is when I try to include the header files from the documentation, VS output spits out error messages. Now I realize that I am using the dll/lib combo and that the .h files are not present in my solution so how do I add the proper includes? I am using QT toolkit also which is working but how I add the other header / dll from the open source library eludes me.
Can someone please point me in the right direction.
You need to do a couple of things to use the library:
Make sure that you have both the *.lib and the *.dll from the library you want to use. If you don't have the *.lib, skip #2
Put a reference to the *.lib in the project. Right click the project name in the Solution Explorer and then select Configuration Properties->Linker->Input and put the name of the lib in the Additional Dependencies property.
You have to make sure that VS can find the lib you just added so you have to go to the Tools menu and select Options... Then under Projects and Solutions select VC++ Directories,edit Library Directory option. From within here you can set the directory that contains your new lib by selecting the 'Library Files' in the 'Show Directories For:' drop down box. Just add the path to your lib file in the list of directories. If you dont have a lib you can omit this, but while your here you will also need to set the directory which contains your header files as well under the 'Include Files'. Do it the same way you added the lib.
After doing this you should be good to go and can use your library. If you dont have a lib file you can still use the dll by importing it yourself. During your applications startup you can explicitly load the dll by calling LoadLibrary (see: http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx for more info)
Cheers!
EDIT
Remember to use #include < Foo.h > as opposed to #include "foo.h". The former searches the include path. The latter uses the local project files.
The additional include directories are relative to the project dir. This is normally the dir where your project file, *.vcproj, is located. I guess that in your case you have to add just "include" to your include and library directories.
If you want to be sure what your project dir is, you can check the value of the $(ProjectDir) macro. To do that go to "C/C++ -> Additional Include Directories", press the "..." button and in the pop-up dialog press "Macros>>".
You mention adding the additional include directory (C/C++|General) and additional lib dependency (Linker|Input), but have you also added the additional library directory (Linker|General)?
Including a sample error message might also help people answer the question since it's not even clear if the error is during compilation or linking.