Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Kwokho

macrumors newbie
Original poster
Aug 20, 2008
6
0
Is carbon c++ ansi? And is there any other compilers other than xcode which is ansi?
 

Cromulent

macrumors 604
Oct 2, 2006
6,816
1,101
The Land of Hope and Glory
Is carbon c++ ansi? And is there any other compilers other than xcode which is ansi?

Carbon is an API. The ANSI standard relates to the language and makes no mention of APIs. In fact Carbon is actually a C API not C++. Xcode is an IDE not a compiler. The compiler that Xcode uses is GCC.

There is also the Intel C/C++ compiler for Mac OS X but that is not free.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I doubt very seriously that there is a C++ compiler that is ANSI compliant. How many support export? That's at least well known, who knows what else is in the standard that few if any compilers support.

What are you trying to achieve? Do you have some code that won't compile with the compiler you have, but you believe it to be standards compliant?

Also, Xcode is not a compiler, it is an IDE that utilizes gcc/g++/java for compiling various languages. You can use g++ from the command line and get the same results as with Xcode.

Perhaps you should define your problem more clearly and we'll be able to give you some better direction.

-Lee
 

Kwokho

macrumors newbie
Original poster
Aug 20, 2008
6
0
did you started programming with HELLO WORLD thing? If so where should I write it in xcode is it the source?
 

Cromulent

macrumors 604
Oct 2, 2006
6,816
1,101
The Land of Hope and Glory
did you started programming with HELLO WORLD thing? If so where should I write it in xcode is it the source?

What resource are you learning to program with?

From the sounds of it I would skip Xcode at the moment and just work with a text editor and the command line. It will be much easier to learn to start out with, worry about Xcode later.

All you need to do is get a decent text editor (I recommend Smultron) and type your code in there. Save the file calling it anything you want but make sure to add a .c extension to it. Then open Terminal in /Applications/Utilities and navigate to the folder where you saved it (if you saved it to the Desktop you would type cd Desktop).

Once that is done type:

gcc -o myprog whateveryoucalledyourfile.c

and your code will be compiled and given the name myprog, obviously you will need to change the filename to whatever you called your file and you can change myprog to anything you like. To run your program type:

./myprog
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
What resource are you learning to program with?

From the sounds of it I would skip Xcode at the moment and just work with a text editor and the command line. It will be much easier to learn to start out with, worry about Xcode later.

All you need to do is get a decent text editor (I recommend Smultron) and type your code in there. Save the file calling it anything you want but make sure to add a .c extension to it. Then open Terminal in /Applications/Utilities and navigate to the folder where you saved it (if you saved it to the Desktop you would type cd Desktop).

Once that is done type:

gcc -o myprog whateveryoucalledyourfile.c

and your code will be compiled and given the name myprog, obviously you will need to change the filename to whatever you called your file and you can change myprog to anything you like. To run your program type:

./myprog

Slight modifications for C++:
Save your file as .cpp, .C, .CPP, .cc, .cp, .cxx, .c++. The first is the most common.
Instead of gcc, run g++:
g++ -o myprog whateveryoucalledyourfile

-Lee
 

Kwokho

macrumors newbie
Original poster
Aug 20, 2008
6
0
how do I make it to a app?
like you can click on it in the dock?
 

Cromulent

macrumors 604
Oct 2, 2006
6,816
1,101
The Land of Hope and Glory
how do I make it to a app?
like you can click on it in the dock?

That'll come later. Concentrate on learning the language first, making GUI applications is something you can worry about in a few months when you have got the basics under your belt. 99% of the stuff you do when learning will be command line based with a programming language like C++.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.