How to use other projects nuget packages as DLL C++ - c++

I made my own Dll project, which includes a standard libraries like:
sstream
string
codecvt
fstream
iostream
string
etc. (non-3-party libraries)
and opencv4.2 (3-party library) which was installed through "Manage Nuget Packages" in Visual Studio.
After building it (creating the Dll and lib files) I linked to it from project, which is made to test the functionality of the dll. The project can't find opencv's libraries.
So I'm curious how to tell the testing project to include the nuget packages from Dll's project.
Note that installing opencv again through "Manage Nuget Packages" to testing Project helps, but it is not an option in my case.

Related

How to get start using z3

I am new to z3. I downloaded the latest version from github and followed the instructions to build using visual studio on windows.
Now, i have to use the z3 c++ APIs in a visual studio project. I imported the code example provided in the package into a new vs project to test it but it can't recognize the z3 header file. Seems that there is some thing missed.
Can anyone guide me in how to use z3 in a vs project?
As usual for shared libraries, you have to add the folder that contains *.h to your include paths and the folder that contains *.dll and *.lib files to your library paths. Finally, add *.lib to the libraries the linker will link. There are heaps of other questions and solutions for that on stackoverflow, see for instance How to include libraries in Visual Studio 2012?.

C++ boost nuget cannot open file Visual Studio 2015

I am making a C++ project (quite new to C++) and it needs the so called "boost" library. I thought I could add it with a nugget to make my life easier...(#include <boost\date_time.hpp> added) but now I am getting this error
Error LNK1104 cannot open file
'libboost_date_time-vc141-mt-gd-1_65_1.lib'
What is the problem?
Error LNK1104 cannot open file
'libboost_date_time-vc141-mt-gd-1_65_1.lib'
According to the error, you should add the libboost_date_time-vc141-mt-gd-1_65_1.lib library directory to your project configuration. This .lib included in the NuGet package boost_date_time-vc140 or boost_date_time-vc141.
Since you are using Visual Studio 2015, you just need install the NuGet package boost_date_time-vc140 to your project, NuGet will add the libboost_date_time-vc141-mt-gd-1_65_1.lib library directory to your project configuration automatically. After installation completed, that error will be resolved.
Besides, since you are use boost library in Visual Studio 2015, I suggest that you can use the boost-vc140, which included many dependencies. So you do not need to add them manually.
Hope this helps.
You need to add the boost library directory to your project configuration, go to the project menu, then properties.
In the property tree go down to 'VC++ Directories' and in the library directories add \lib64-msvc-12.0 (change the 64 to 32 for 32 bit builds).
I suggest you do this through view->other windows->property manager, then it will be set up for all future projects as well.
The reason why you have a link error is because you installed the header-only NuGet "Boost" package. However, due to an unfortunate design decision, this header-only package also contains header files for Boost libraries that are not header-only, such as datetime. With a better design, you would have gotten the error earlier (at compile time).
The "Boost.vc120" and "Boost.vc140" packages contains both header-only libraries and regular compiled libraries; the difference between them is the compiler used.

Where are nuget package manager include directories set in VS 2015?

i am currently trying my first steps with nuget package manager (3.4.3.855) in VS 2015 (Enterprise). For my C++/Qt project i managed to find some libraries i need and they seem to be correctly downloaded to <myprojectDir>/packages/<package_name>/... folders.
However, it is a mystery to me, where and how include folders for headers and/or libs are specified for the project?
I mean, for example with the Eigen library, after importing the nuget package i can just #include <Eigen/core>, which is located in
<myprojectDir>\packages\Eigen.3.2.9\build\native\include
and everything works fine, but i neither have the packages\Eigen.3.2.9\build\native\include-path popping up in the VC++ Directories->Include Directories list in the property pages nor is there a custom property page in the project properties (yes, i did not click the solution properties ;) ) as seen e.g. in this example video with the zlib package. I do not even have this property page if I install the zlib package.
While it seems to work somehow under the hood for Eigen, it does not for the Visual Leak Detector (vld) package... so knowing how things work would be great ;)
Thanks for any help...
From NuGet 2.5, C++ project recognizes the installed packages through MSBuild properties and targets files from NuGet package. After installing packages in C++ project, the MSBuild files are imported into your project file. So the projects will know how to find and use the contents of the NuGet Packages.
To make MSBuild integration better, NuGet has created a new convention for automatically importing MSBuild properties and targets from a NuGet package. Alongside the existing \content, \lib, and \tools folders, NuGet now recognizes a new top-level folder: \build. You could open the Eigen package that you have installed through NuGet Package Explorer, there has a \build folder and a Eigen.targets file which contains MSBuild properties.
Please refer to the MSBuild Integration part from below link:
http://blog.nuget.org/20130426/native-support.html

Setting up Aquila for my c++ Project in Visual studio 2012

I want to use Aquila DSP to compute MFCC features in my project and trying to make it work.I followed this tutorial but after mingw32-make install on the source code pulled from Aquila's git repo, it generates only libAquila.a in lib folder. I tried changing my project's include and library dependencies using these generated files after install. Also tried adding FindAquila.cmake and tried building my project with cmake for VS 2012, still no luck. Keep getting "aquila/global.h" no such file or directory when I try to include "aquila/global.h".
I also tried building Aquila with cmake for VS 2012 and able to compile it and it generates .lib files as well, but not sure how to proceed with that.
If anyone knows how to make it work, it will be great help.
So, I made it work with Visual studio 2013. Now what I am doing is I am building Aquila with both Mingw and with VisualStudio. Mingw gives required include files and visual studio build gives required .lib files. I am building Aquila in VS 2013 with configuration type static lib (project properties >> General >> Configuration type) for both debug and release configuration and then I build the project.
For Mingw, first I use cmake GUI with mingw cmakefiles configuration and then run mingw32-make install in the build directory, which will put the include, lib and share files in the installation directory( usually C:\\Programme files\\Aquila.
Now I create a Folder Aquila and put include and share from above path and create a new folder lib with two subfolder debug and release. Here I put two .lib files in each folder (aquila.lib and Ooura_fft.lib) (debug libs in debug and release libs in release folder, they will be VS build folder). Once this is done, in my project setting, I add Additional include directories under C++ >> general, Addiotnal library path under linker >> general and names of libraries under linker >> input for both bebug and release configuration. After doing all these things, now the library works with my project.

Troubles linking the libnoise library to a project in Visual Studio 2010

I am still fairly new to C++ and even newer to Visual Studio. I am attempting to link the perlin noise library 'libnoise' (found here) to my visual studio 2010 project, I have searched online for many many hours to no avail, this has been a road block for a few days now.
What are the steps needed to link this library?
The files that are downloaded are a bin folder (contains the .dll and .lib) and a include (headers I believe)
thank you in advance and please correct any mistakes I have made with asking this question.
You'll need to:
1. Add the header directory to Additional Include Directories (PROJECT->Properties->Configuration Properties->C/C++->General->Additional Include Directories, on drop down select <Edit...>)
2. Add the .lib directory to Additional Library Directories (PROJECT->Properties->Configuration Properties->Linker->General->Additional Library Directories, same above)
3. Add the .lib names you need to Additional Dependencies (PROJECT->Properties->Configuration Properties->Linker->Input->Additional Dependencies, same above)
4. After building your project, copy the .dll to your project's build directory, usually at your solution's Debug directory ("Solution Path"/Debug) or you would encounter *.dll is missing error. You should find "yourapp".exe file there as well.
Good Luck.
Edit: more can be found at http://en.wikibooks.org/wiki/C%2B%2B_Programming/Compiler/Linker/Libraries/Configuring_Visual_Studio
You can use nuget.
Open package manager console and type : Install-Package libnoise