3

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?

kotoko
  • 599
  • 2
  • 6
  • 22

1 Answers1

0

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.

peaceman
  • 1,499
  • 2
  • 17
  • 29
  • You misunderstand me. I already did this, I'm just hitting the build button after the code is done. – kotoko Apr 01 '12 at 16:23
  • when I press build I get this error over here [link](http://stackoverflow.com/questions/7533321/error-when-compiling-some-simple-c-code). He says I have to compile with g++ compiler instead of gcc that's why I'm asking. – kotoko Apr 01 '12 at 18:04