Installing the Eigen library in Visual C++ 2010 - c++

How can I install the Eigen library in Visual C++ 2010? I downloaded the library from eigen.tuxfamily
But I do not know how can install it on my Visual C++. I want to run a program I downloaded and it has the following:
#include <Eigen/Core>
using namespace Eigen;
How can I do this? I have tried to look online but I seem to get confused. Could someone explain to me how I can do it?

Eigen is mostly header-only library. All that you need is to add Eigen path to (MSVC2010):
Project Properties -> C/C++ -> General -> Additional Include Directories
Let's say you have header Core in folder C:/folder1/folder2/Eigen/, i.e.:
C:/folder1/folder2/Eigen/Core
So you should add path C:/folder1/folder2 to Additional Include Directories.

From the Eigen docs:
How to "install" Eigen?
In order to use Eigen, you just need to download and extract Eigen's source code (see the wiki for download instructions). In fact, the header files in the Eigen subdirectory are the only files required to compile programs using Eigen. The header files are the same for all platforms. It is not necessary to use CMake or install anything.
...
Compiling and running your first program
There is no library to link to. The only thing that you need to keep in mind when compiling the above program is that the compiler must be able to find the Eigen header files. The directory in which you placed Eigen's source code must be in the include path.
So you don't actually install anything.

Related

Utilizing the Boost library in a C++ project

I've imported the boost library files into my project, the issue is VS studio is not recognizing the files based on the default include directory locations.
I can go into properties->config properties->C/C++->General->add include directories ... but it is a pain to do so for so many directories.
VS Code tells me to install vcpkg ... what's the easiest means of including the dependencies without reconfiguring directory settings?
ie: Using this default location for all boost files.
#include <boost/math/special_functions/bessel.hpp>

How can Codeblocks find my header files even without adding any search paths

I'm learning to use OpenCV (and C++) in Codeblocks. What confuses me, however, is that when I start to include header files from OpenCV in my main.cpp file, Codeblocks automatically suggests to me the files as shown in the image below.
I have not included any search paths to project build options, so how is this possible that Codeblocks can find the files? Is there some other variable working here that I'm unaware of?
Note that I'm a beginner with both Codeblocks and OpenCV and that I only have a little experience with C++.
Thank you
Of course when you install an IDE like code::blocks by default, it knows about standard path for library on your OS.
On my OS -> Ubuntu that is /usr/include
It only searches on a standard path, except you add one. If you install your library by command-line, it goes to the standard place, if you installed manually, then it depends on your option you added to installation. I can not see you screen-shot but it has access to /usr/include by default.
For more detail on Linux and OpenCV
And here is a screen-shot of codeblock on Ubuntu that I added some 3rd-party library
NOTE:
if you install any libraries by command-line, just use it.
But if you have installed them manually, you need to add 2 things to codeblock.
1. First is your path for header file
2. Second is your path for linker
And you see it in screen-shot that say: Search Directory
First is for header and second is for linker

How to correctly include Dlib in Eclipse project?

I'm currently trying to use the Dlib c++ library in my own project. So I included the main folder of dlib to my project. I also added the dlib/all/source.cpp to my project. When I try to compile the code of the svm_c_ex.cpp example in my own test.cpp file, I only get:
fatal error: dlib/svm.h: No such file or directory
The section Dlib: How to compile didn't help me and I couldn't find further information online. Any help is appreciated!
You need to compile the DLib library first, using the instructions from the website.
cd examples
mkdir build
cd build
cmake ..
cmake --build . --config Release
cmake is a famous tool to build software on multiple platforms. It generates required files first and then you can compile the library using those generated files later.
You need to add the "include" directories (the folders where the headers exist) in your project configuration. I'm quite not sure of where exactly to add in Eclipse CDT.
After that, your program gives linker error because the the header files only contain skeletons of your library code. Actual implementation need to be linked with "linker options" in project properties. You need to add your library's .lib/.a files with your program. I don't exactly remember where is linker options in CDT (I'm talking in Visual Studio context)
Basically for any library you want to use in any C++ project:
You need to include HEADERS in your project properties
You need to link to actual implementation of the library. You can read about
static and dynamic libraries (Someone on SO must have given an
awesome explanation)

can't compile c++ netlib 0.11.0 in vs2013

I'm trying to get c++ netlib 0.11.0 working with Visual Studio 2013, and I'm having quite a difficult time. I placed the netlib main folder in my visual studio folder, and I set the include directory properly. You can see this clearly in the following image:
http://i.imgur.com/mfGmpHv.png
The documentation / examples for c++ netlib tell me that to get started, I need to include
#include <boost/network/protocol/http/client.hpp>
but when I do this, my compiler can't find anything as shown below:
http://i.imgur.com/HyVFezq.png
Am I supposed to merge the contents of the cpp netlib with the boost library? I've tried to do that as well but I get a whole other list of problems. I have no idea how to get this working, anyone have any ideas?
Simply install the latest release of Boost and make sure the project's include and library paths are set to include where you installed (and compiled) Boost.

How can I use boost::test with xcode 4 for testing some ios c++ code?

I would like it to operate similarly to how the normal test framework works - if you the tests from the Product->Run tests menu item, the output should appear in the left sidebar window.
I found a guide for using xcode 3 with boost test, but couldn't figure out how to translate those instructions for xcode 4 (if it is even possible).
Finally, I'm building an iPhone application. I could get boost running using the #include <boost/test/included/unit_test.hpp>, however it is pretty slow. Using the standard #include <boost/test/unit_test.hpp> results in link errors due to the library being built for the wrong architecture.
You should build the boost library to a static library ".a" using .configure and make.
According to this:
No special build options or macro definitions are required to build
the static library. Using the Boost.Build system you can build the
static library with the following command from libs/test/build
directory:
bjam [-sTOOLS=] {-sBUILD=boost_unit_test_framework}
This library or libraries and their respective headers need to be added to the project. (Two built versions are needed, one i386 for the simulator and one ARM for devices).
The static library is imported from Link Binary with Libraries in
Build Phases.
Also you need to tell XCode which of these to use, you
can do this by setting contidional build settings in `Build settings-
Library search paths. Above this line is where you add the Header
Search Path to the boost header files.
After this you should be able to include the headers (Added above) in C++ or objective-C++ code of yours. (To make Obj-C files Obj-C++ files you need to change all deppendent .m files to .mm)
If there is a some problems after this, switching Compiler or standard library for C++ in Build Settings might help.