Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > GCC in Jaguar?

GCC in Jaguar?
Thread Tools
Junior Member
Join Date: Oct 1999
Location: Greenville, NC USA
Status: Offline
Reply With Quote
Sep 25, 2002, 07:16 PM
 
I'm amazed that gcc isn't included in jag?

Where can I get gcc for jaguar?
Or any other c++ compiler that can do console..

thanks
tim

<I tried to search for this but the engine was down>
     
Mac Elite
Join Date: Mar 2001
Location: Provo, UT
Status: Offline
Reply With Quote
Sep 25, 2002, 08:00 PM
 
It is included with Jaguar. Go to the /Developer directory. There should be a package you install. If you upgraded to Jaguar then go to apple.com and click on the developer tag. Login and go to the download page. Download the latest developer tools. (July plus an update in August) Be prepared as it is a large install (~250 meg)

GCC is part of the standard development tools.
     
Mac Enthusiast
Join Date: Nov 2001
Status: Offline
Reply With Quote
Sep 25, 2002, 08:20 PM
 
gcc is included with the Developer Tools. Apple has renamed the C compiler cc and the C++ compiler c++.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Sep 27, 2002, 04:58 PM
 
Originally posted by Ibson:
gcc is included with the Developer Tools. Apple has renamed the C compiler cc and the C++ compiler c++.
Actually they're now gcc and g++ in 10.2, too.
     
ego
Fresh-Faced Recruit
Join Date: Aug 2002
Status: Offline
Reply With Quote
Oct 1, 2002, 07:53 PM
 
Originally posted by Ibson:
gcc is included with the Developer Tools. Apple has renamed the C compiler cc and the C++ compiler c++.
And, really, the traditional name of the c compiler on most Unix is cc.
The reason gcc doesn't follow this convention on many platforms is that is rarely was the default compiler. So people who have dirty C code (code relying on gcc-isms) get into the habit of building using gcc explicitely.

Apple is entirely correct in renaming gcc to cc, since gcc is the vendor compiler on OS X.
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Oct 1, 2002, 10:18 PM
 
gcc-isms can be very annoying indeed... I was giving some advice to a friend recently who was doing a programming assignment - pure C - using gcc under GNU/Linux, and was amazed to see the following line of code:
Code:
int array[atoi(argv[1])];
And GCC accepted this without question, even with -Wall. It took -strict, -ansi and -pedantic in combination to get it to choke on something that is not ANSI C! It might be nice be able to dimension your arrays at runtime, but just you try using that code in any other compiler...
[vash:~] banana% killall killall
Terminated
     
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status: Offline
Reply With Quote
Oct 3, 2002, 02:44 AM
 
Depends which ANSI C you're talking about :-)

In the older C89 spec, yes, variable-length arrays were prohibited (but was a feature supported by gcc). In the newer ANSI C99 spec, they *are* allowed, and gcc 3.x has been rolling in support for the newer features. You need the -ansi flag to choose C89 (which equates to -std=c89), plus the -pedantic to make sure no extensions to C89 are allowed, to get your desired behavior.

In general though, that code will begin to be supported on more and more compilers as they are updated for C99 compliance. See http://home.tiscalinet.ch/t_wolf/tw/c/c9x_changes.html for a more detailed list of changes.
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Oct 4, 2002, 04:08 AM
 
...interesting. I should probably have gone to that website about three years ago. Thank you!
[vash:~] banana% killall killall
Terminated
     
Mac Elite
Join Date: May 2001
Location: NYC
Status: Offline
Reply With Quote
Oct 4, 2002, 02:09 PM
 
Well, I about to start a new topic, titled something like Designer tries to learn programming, beginning with gcc but perhaps I'll glom myself onto this thread instead.

I've long wanted to teach myself a little C, and am at least beginning using ProjectBuilder, and gcc.

I can't get my first hello world to work using gcc, though. Here's my code:

Code:
#include <stdio.h> int main(void) { int num; printf("Hello world! Give me an integer:\n"); scanf("%d", &num); printf("Thanks! I've always been fond of %d.\n", num); return 0; }
This is saved in ~/Documents/Code/Exercises, in the file "hello.c". It's a plain text file, saved in BBEdit w/ UNIX line breaks.

When I type the command

gcc hello.c

the file "a.out" is created. I expect this to be the compiled prorgam.

Typing "a.out" in the Terminal, however, I get "Command not found".

Are there header files I'm missing to compile correctly? Do I need to have main.h or stdio.h in there? Afraid I'm still trying to pick up the basics here.

My apologies in advance is this all stupid beyond belief.

Thanks!
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Oct 4, 2002, 02:20 PM
 
If you're using the default shell, you'll need to type ./a.out instead of just a.out (to specify that it's in the current directory rather than the standard location for commands).
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Mac Elite
Join Date: May 2001
Location: NYC
Status: Offline
Reply With Quote
Oct 4, 2002, 02:25 PM
 
Originally posted by Chuckit:
If you're using the default shell, you'll need to type ./a.out instead of just a.out (to specify that it's in the current directory rather than the standard location for commands).
Thanks!

I didn't realize ~ was the standard location for commands.

You saved me a heap o' head-scratching.

Is there a good resource online or book that you would recommend...? I've Googled and Amazoned and am rather overwhelmed by the options.
     
Professional Poster
Join Date: Sep 1999
Location: Ottawa, ON, Canada
Status: Offline
Reply With Quote
Oct 4, 2002, 03:01 PM
 
Originally posted by lookmark:


Thanks!

I didn't realize ~ was the standard location for commands.

You saved me a heap o' head-scratching.

The standard location is basically anything that is in your PATH environment variable. I believe you can add ./ to your PATH that will save you typing that each time.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Oct 4, 2002, 04:26 PM
 
Originally posted by hayesk:
The standard location is basically anything that is in your PATH environment variable. I believe you can add ./ to your PATH that will save you typing that each time.
Though this is a bit of a security risk.
     
Senior User
Join Date: Jan 2000
Location: Burlington, VT, USA
Status: Offline
Reply With Quote
Oct 9, 2002, 01:02 PM
 
you can also type:

gcc -o output file.c

and output will be the name of your program.

Vwaala!

Jon




This is saved in ~/Documents/Code/Exercises, in the file "hello.c". It's a plain text file, saved in BBEdit w/ UNIX line breaks.

When I type the command

gcc hello.c

the file "a.out" is created. I expect this to be the compiled prorgam.

Typing "a.out" in the Terminal, however, I get "Command not found".

Are there header files I'm missing to compile correctly? Do I need to have main.h or stdio.h in there? Afraid I'm still trying to pick up the basics here.

My apologies in advance is this all stupid beyond belief.

Thanks! [/B]
     
Junior Member
Join Date: Feb 2002
Status: Offline
Reply With Quote
Oct 9, 2002, 04:39 PM
 
Originally posted by lookmark:


Thanks!

I didn't realize ~ was the standard location for commands.
It isn't. That's what the problem was .
self = [[JeffBinder alloc] init];
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:50 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2