mardi 31 mars 2015

MACRO depending on its folder location

In the following files:



app/main.cpp
app/config.hpp
app/show.hpp
app/file.hpp

lib/append.hpp
lib/clear.hpp
lib/reopen.hpp
lib/crypt.hpp


I have a problem. Imagine a few of my files use lib/crypt.hpp. For example in app/file.hpp I should write:



#include "../lib/crypt.hpp"


If I take this file to lib folder it does not work anymore. So I need a something like:



#include "LIB/crypt.hpp"


So, this LIB/ has meaning of (empty) in lib directory while it has meaning of "../lib/" in app directory.


Then I will have no worry about moving file.hpp from app to lib. I just need to fix the callers of it. But not what it calls.


Similar to concept of web programming frameworks. Is it possible in C/C++?


Aucun commentaire:

Enregistrer un commentaire