How to run C++ from Xcode 5.02

馋奶兔 提交于 2019-12-06 05:45:23
virindh

Xcode supports c++ in objective-c projects through .mm files, but not on its own.

UPDATE: Guess I was wrong, see here: http://neilmonday.blogspot.com/2008/02/how-to-compile-basic-c-programs-in.html and here: How do I create a new C++ project in XCode?

Run xcode-select --install to make sure you command line tools installed on the system.

In Xcode, select File>New>Project. Then navigate to the Application tab under OS X. The last choice will be "Command Line Tool". Hit Next. Then, select C++ in the type pulldown menu at the bottom. Name your project, hit next, choose a place to save, and click Create. You will see a file called main.cpp. Select it, and you're ready to go!

zaph

See this SO answer for help with command line tool installation.

Basically the terminal

command is

xcode-select --install

The other option is to create a C++ Command Line tolls project.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!