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 > cc compile problems

cc compile problems
Thread Tools
Fresh-Faced Recruit
Join Date: Aug 2002
Status: Offline
Reply With Quote
Jan 22, 2003, 08:58 PM
 
I try to complile the program below in 10.2's terminal and I get this error:

[powerbook:/cs240] jason% cc ./hello.c
/usr/bin/ld: /usr/lib/libSystem.dylib load command 9 unknown cmd field

What am I doing wrong?

#include <stdio.h>

int main(void)
{
int n, count;
char myChar;
printf("Please enter an alphabetic character to print: ");
scanf("%c", &myChar);
printf("Please enter times to print: ");
scanf("%d", &n);
printf("\n\n");
for (count=0; count < n; count++)
{
printf("%c", myChar);
}
printf("\n");
return 0;
}
     
Forum Regular
Join Date: Mar 2002
Location: San Jose, CA
Status: Offline
Reply With Quote
Jan 22, 2003, 11:36 PM
 
try:
gcc hello.c

It should work then (the output file is "a.out").
     
Mac Elite
Join Date: May 2002
Status: Offline
Reply With Quote
Jan 23, 2003, 04:17 AM
 
I think you've got compiling the program and running it mixed up.
gcc hello.c
THEN ./a.out
or alternatively, gcc -o hello hello.c, then ./hello
[vash:~] banana% killall killall
Terminated
     
   
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 02:05 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