Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 10 Broke Autocomplete When Inserting Include Names for C++, Any Workarounds?

Tags:

include

xcode

I no longer get any autocompletion results when I begin to type a standard header file name in the include statements:

#include <>

Normally, typing in a name such as vector or string would cause the autocompletion list to open and display results for these library names, but it is not happening in Xcode 10. I'm getting some autocompletion results for other headers, but nothing related to the standard C++ libraries. Does anyone know any workarounds or solutions to this? I asked in the Apple developer forums, but I've received no help after a week now.

I know that directory for standard C++ library files is:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1

But I'm unaware where this would be placed in Xcode to hopefully get it to allow for autocompletion of headers for all projects in Xcode (and not just whatever specific project is loaded.

Any help is greatly appreciated.

like image 796
joe_04_04 Avatar asked Sep 26 '18 01:09

joe_04_04


People also ask

Why is autocomplete not working Xcode?

This can happen when the file is not a member of the Target. Open the file where autocomplete is not working and show the the "Utilities" tab in the top right of Xcode (blue in the screenshot below). Ensure your Target (typically your app's name) is checked.

How do I get suggestions in Xcode?

Show/hide completions: ⎋ ( Escape ) OR ⌃Space ( Control + Space ) Type some code, use either ⎋ or ⌃Space to toggle auto-complete (I'm hooked on Escape ), and Xcode will offer a few intelligent suggestions to complete your code.


1 Answers

Add the above mentioned path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 to your project 'Build Settings' -> Header Search Paths -> Debug -> Any Architecture.

enter image description here

like image 199
Jay Avatar answered Oct 01 '22 19:10

Jay