I am currently learning C++ and I came across include guards to avoid double inclusion.
Now I would like to use the google's style convention like this :
// project/src/app.hpp
#ifndef PROJECT_SRC_APP_HPP_
#define PROJECT_SRC_APP_HPP_
...
#endif // PROJECT_SRC_APP_HPP_
and also
// project/src/util/test.hpp
#ifndef PROJECT_SRC_UTIL_TEST_HPP_
#define PROJECT_SRC_UTIL_TEST_HPP_
...
#endif // PROJECT_SRC_UTIL_TEST_HPP_
So the macro name is basically the path of the header file in the current project.
My goal is to automate this task of writing the include guards each time I create a new .hpp
file.
I looked at the emacs auto insert mode which looks adapted to the situation but the question is the following :
I am using projectile so how can I get the full path from the root directory of the current project to construct the macro name?
Can anyone point me into the right direction? (btw I am using spacemacs)
projectile-project-root
which tell you the projectile workspace root directory, about the second question seems like for that task you could use yasnippet it's a template system quite easy and useful. Good luck!