# c++ compiler works or not?



## travelgz (Oct 18, 2001)

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 (Oct 18, 2001)

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 (Oct 18, 2001)

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 (Oct 18, 2001)

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 (Oct 18, 2001)

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 (Oct 19, 2001)

> _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 (Oct 19, 2001)

> _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.
> ...



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 (Oct 19, 2001)

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 (Oct 26, 2001)

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 (Oct 26, 2001)

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 (Oct 27, 2001)

> _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:
> ...



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

better get busy...times 'a wastin'


----------



## travelgz (Oct 27, 2001)

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


----------

