简体   繁体   English

Xcode使用cpp文件创建捆绑

[英]Xcode create bundle with cpp files

I'm trying to create a bundle application using Xcode 10.3. 我正在尝试使用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. 主要代码将存在于C ++文件中,该文件已添加到捆绑项目中,并且还需要使用一些与Cocoa相关的东西。 and here is the catch, anytime I include 这是渔获物,只要我包括

#include <Cocoa/Cocoa.h>

I immediately get like 20 errors 我立即得到20个错误 在此处输入图片说明

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? 在Xcode中还有其他要添加或设置的内容,以便可以在CPP文件中包含Cocoa标头吗?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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