H.Y
H.Y

Reputation: 23

Include from directory C++

I am trying to run this code

http://dlib.net/dlib/statistics/cca.h.html

As you can notice, it contains many include, which I copy them. But inside each include there are a lot of includes like this :

#include "../matrix.h"

It contains

#include "matrix/matrix.h"
#include "matrix/matrix_utilities.h"
#include "matrix/matrix_subexp.h"
#include "matrix/matrix_math_functions.h"
#include "matrix/matrix_assign.h"
#include "matrix/matrix_la.h"
#include "matrix/symmetric_matrix_cache.h"
#include "matrix/matrix_conv.h"
#include "matrix/matrix_read_from_istream.h"
#include "matrix/matrix_fft.h"
#include "matrix/matrix_generic_image.h"

Is there any method to just include the main class? For example give the directory or the link of the classes?

Upvotes: 0

Views: 226

Answers (1)

Nacho
Nacho

Reputation: 1124

I bet the problem lies with your include directories.

I assume you downloaded the full zip file from http://dlib.net/ (latest version seems to be 18.18). Inside that .zip you have a bunch of folders: examples, tools, dlib. In dlib folder you have all the header files.

You should add the path to wherever you extracted the .zip contents to the "Additional Include Directories" property of your project:

enter image description here

Then just use dlib in your own code as showed in the examples, for instance 3d_point_cloud_ex.cpp:

#include <dlib/gui_widgets.h>
#include <dlib/image_transforms.h>

Initially there is no need to create extra header files, all seems to be provided with a nice folder structure. I encourage you to read dlib's documentation before start using it.

You might also want to check this answer to another question to help you build a handy project folder structure.

Upvotes: 2

Related Questions