Xcode poor support for C++

I try to use Xcode (v.7.3.1) for my C++ project (build system - make), but the experience is quite poor (and it was always like that since old versions like v4 when I started using it) - code completion doesn't work, color syntaxing works oddly (no coloring sometimes, or partially colored code), no "jump-to-definition" functionality, can't switch b/w header/source files with shortcuts. Basically, it's just a text editor where I have to use "Find" and Cmd+Shift+O all the time.

Is this intentional and Xcode will never get any proper support for C++ projects with external build system (make) or am I misconfiguring my project? How can I re-index files in the project? How can I make code completion work?


Thanks,

Impossible for me to guess what is wrong but I can tell you that this is certainly not normal behavior. Perhaps try to create a project from one of the templates and add a few C++ files to see that it actually works - if it doesn't the problem is somehow related to the files that you add

Hm.. it actually works nicely if I create console application in Xcode.

One thing I noticed - header files are ".hpp" and my headers are all ".h". Could this be a potential problem?

This stack overflow question may be relevant to your issue...

http://stackoverflow.com/questions/152555/h-or-hpp-for-your-class-definitions

Unlikely to be the .hpp extension as these days this is exactly what Xcode itself generates when creating a new C++ file and header

I just added a new c++ file to an empty project using Xcode 7.3.1 and it created .cpp and .hpp files.


EDIT:

Out of curiosity, I asked it to create a C file and got .h and .c files

So, I ended up using this workaround: even though, I use external build system, I create "Console Application" project in Xcode and choose "C++ language" in settings. Then, I simply add my source files to the project (just drag folders from the Finder window) and then manually create project targets of type "External Build System" as I need.

Files get indexed in this case with no problems. I'm also able to debug code as I used to.


I still think Xcode developers should review indexing process for the projects with external build system...


Thanks for all the insights though!

better use windows for c++

I have to agree with the assesment of the authors who have posted to this thread: I don't believe the Xcode development team is putting too much effort into C++ support, since their main focus is probably Swift and Obj-C.


I write a lot of C++17 and C++14 code, and the Xcode editor doesn't seem too happy with that syntax, so I use Xcode in combination with SublimeText, xcodebuild and xcpretty to get my work done.


This is not an ideal solution, but the only one that works till Apple get's their IDE up and running with C++XX.

Until interop works between Swift and native c++ the overall support by Apple for c++ is going to remain awful.

Based on feedback, the Xcode 9 beta clang has C++17 support. Xcode 9 beta also allows you to set to use language version C++17. You can already compile C++14 compliant programs by setting the C++ Compiler version in the Build settings. Have been using Xcode with C++14 support for awhile with no problems.

Xcode poor support for C++
 
 
Q