Getting Xcode to recognise C++ header files withou

2019-06-16 09:22发布

问题:

OpenSceneGraph uses header files without the '.h' extension. Is there a way of getting Xcode to recognise the syntax as C++ and therefore allow me to have highlighting and jumping to definitions etc?

Eg: No highlighting:

回答1:

Yes. Toggle the right panel (the rightmost icon of the "View" section of the toolbar, arrow 1 in the screenshot) with your file selected. Select the document tab in the panel (arrow 2), then find "File Type" under "Identity and Type" (arrow 3). Choose "C++ header" in the dropdown list.

You will need to reopen the file for the syntax coloring to kick in.