xcode creates a C++ class file The header file generated is .hpp not .h

The suffix of the header file generated by creating a C++ class becomes .hpp,
not a .h file
. Both files can be compiled normally,
but it can be seen from the naming that there is a certain difference.
Generally, .h is just a declaration, while .hpp There are both function declarations and function definitions in the file description,
just as most developers define inline functions in .inl files.
Since I have developed a long-term usage habit,
I have to manually change the file extension and the comment information of the file header every time.


Just find the template location where xcode generates the C++ file,
/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/File\
Templates/Source/C++\ File.xctemplate/WithHeader rename
the ___FILEBASENAME___.hpp file to ___FILEBASENAME___.h, and then modify the corresponding .hpp in the content of the ___FILEBASENAME___.hpp and ___FILEBASENAME___.cpp files
to .h

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326118993&siteId=291194637