Getting Xcode to recognise C++ header files without the '.h' extension (OpenSceneGraph)
Asked Answered
C

1

9

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:

enter image description here

Carnelian answered 4/5, 2012 at 1:24 Comment(0)
V
9

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.

Graphical version of the previous explanations

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

Vikki answered 4/5, 2012 at 1:28 Comment(4)
Is there a way to make Xcode do this automatically for certain extension so that it doesn't have to be repeated manually for each such file?Bladderwort
I'm on a Windows machine right now so I can't check, but while I know for sure you can't do that for files without extensions, I'm pretty sure you can do that for specific extensions from one of the tabs in the project settings. Click your project in the file explorer and check the build rules.Vikki
What about for files in library/system headers that are not part of any project?Valvular
@OrangeDog, can't help you with that one.Vikki

© 2022 - 2024 — McMap. All rights reserved.