简体   繁体   中英

Xcode create bundle with cpp files

I'm trying to create a bundle application using Xcode 10.3. The main code is going to live inside a C++ file, which I added to the bundle project, and I also need to use some Cocoa related stuff. and here is the catch, anytime I include

#include <Cocoa/Cocoa.h>

I immediately get like 20 errors 在此处输入图片说明

which are rather strange. Is there anything else to be added or set in Xcode so I can include Cocoa headers inside a CPP file?

看起来该解决方案比预期的要容易,您只需要将cpp文件的编译类型从C++ Source更改为Objective-C++ Source ,然后按需要进行所有编译即可。

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