How to run C++ from Xcode 5.02

2019-05-23 14:28发布

I haven't used Xcode in awhile and overall new to macs. How od I run a C++ program from Xcode V5.02. I don't see a command line function anymore?

标签: xcode xcode5
3条回答
Anthone
2楼-- · 2019-05-23 15:12

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.

查看更多
时光不老,我们不散
3楼-- · 2019-05-23 15:21

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.

查看更多
家丑人穷心不美
4楼-- · 2019-05-23 15:22

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!

查看更多
登录 后发表回答