AddIfndefGuard : Add the #ifndef/#define/#endif guard to a C/C++ header file
script karma |
Rating 21/18,
Downloaded by 992 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Rory McCann |
|
script type |
utility |
|
description |
When one writes a header file for C/C++, compile errors will occur if the same header script is included more than once. A common solution is to add
#ifndef FILENAME_H
#define FILENAME_H
to the start of a file, and
#endif
to the end. This solves the problem.
However this is mechanical and routine. So the computer should do it. So here's a script to do it.
It will add those lines to the top of the file you call it in. It will change FILENAME to be the uppercase name of that file, ommiting the file extension. It will not (yet) check to see if a #define/#ifndef/#endif black has already been added. It will not check the filename, so it can be called on anyfile. |
|
install details |
Unzip the file. Read the README (if you want). Place AddIfndefGuard.vim to the plugins directory. (On UNIX it's ~/.vim/plugins/) |
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 18.216.251.37
|