Search code examples
xcodexcode5

How to make XCode use .hpp header rather than .h when creating a new C++ class?


When I use XCode to create a new C++ class it uses .h rather than .hpp for the header file. Thus I have to manually edit the file if I want it to be .hpp. Is there any way for me to make it generate a .hpp file instead?


Solution

  • You could change the extension of the header file by creating a custom file template. Make a copy of Apple's C++ class template and change the extension of the file FILEBASENAME.h to .hpp.

    If you don't know where to find Apple's file templates or where to store your custom file template, refer to my answer to the following question:

    Change copyright / top-comment / “header” on ALL new files in Xcode 5