简体   繁体   中英

Indexing and syntax highlighting not working in Xcode when using a Makefile to build

I'm using Xcode for a C++ project that uses a Makefile to build. The problem is, that Xcode doesn't seem to index the source on the fly (or at all). I have no syntax highlighting, no live compile error warnings and I can't "Jump to definition", because I get a "Symbol Not Found" error.

Is it possible to get Xcode doing all these things when using Makefiles or will I have to add an additional C++ target?

For Xcode to index your project you have to add another target, choose "Command line tools" for target type. Then add all .c and .cpp (and any other source file you want to be indexed) to the compile resources in build phases. You should get syntax highlighting after a few moments (might take longer depending on size of your project.

在此输入图像描述

Compiler warnings/errors should appear depending on your project settings. If not you have to revisit your schema and target settings. I'll be posting ac project on my github shortly which does all these.

UPDATE 1

Sample C Project in Xcode https://github.com/CaziSoft/BLE-Keyboard

UPDATE 2 To my understanding you can't debug any C/C++ apps unless you can use LLDB . GDB is not supported anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM