make a include of a library out of the library folder

Asked

Viewed 864 times

0

How do I include a library that is not in my library folder in C++?

I know the directive of #include with <> can do the include of the file that is not in the same folder, but if I own multiple folders with a library with the same name, I wonder if it wouldn’t confuse the library that I created with other libraries of other C++ projects that I also created on my PC.

I wonder if there’s an option for him to search in a folder off the root without I need to put all the way from where it is, "", or he will be able to find my library with <> even if I have other libraries in other folders with the same name?

I appreciate anyone who can help me.

  • This can be configured in your IDE, for example, in the visual studio you can search the 'include' folders in the options and put/type your folder there.

1 answer

1

You can put a part of the path name as follows:

#include <projeto1/meuHeader.h>
#include <projeto2/meuHeader.h>

However, the path of these projects will need to be in the list of includes and in the list of linked libraries. This final part depends on how you are working, can be in Visual Studio/Eclipse directly, Makefile or Cmakelist.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.