简体   繁体   中英

How to define g++ or clang++ in xcode 4?

How do I use a c++ compiler (g++ or clang++) to compile a simple c++ project in xCode 4?

You can assume I am in the project, in the Build Settings. I have in Build Options -> Compiler for C/C++/Objective-C -> Apple LLVM compiler 3.0 and LLVM GCC 4.2 as options.
Is either one appropriate or do I have to install another one?
How do I do that?

For running a simple code with Xcode after running Xcode choose “Create a new XCode project”. (You can also go to “File|New|New Project...” or press Shift-⌘-N). This will bring up a screen in that screen select "Application"then select "Command Line Tool" and then click next .Now enter a name for your project and select type c++ and click next in upcoming screen select a directory for you project and click "create" now you can write codes in main.cpp file in the left panel for running your code just click on "Run" button .

Update:

In Build options click "Build settings" and then click "All" from "C++ language Dialect"and "C++ standard library"tab you can choose the compiler and c++ standard that you want included c++11.

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