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 > problems compiling c

problems compiling c
Thread Tools
cdc
Fresh-Faced Recruit
Join Date: Sep 2005
Status: Offline
Reply With Quote
Nov 15, 2005, 06:47 AM
 
hi,

I just copied some c files from a unix machin to my ibook. After using installing xtools(which provided me gcc and gmake), I thought I was able to compile my program.
Unfortunately It gave the following errors

chundongchau$ make
gcc -o ../Run/boltzmann boltzmann.o -lm
/usr/bin/ld: boltzmann.o bad magic number (not a Mach-O file)
collect2: ld returned 1 exit status
make: *** [boltzmann] Error 1

How can I solve this?

I also tried to compile another file, but then it complained about the

-march=pentium

what do I have to type instead of pentium?

Thanks in advance

cdc
     
Fresh-Faced Recruit
Join Date: Jul 2005
Status: Offline
Reply With Quote
Nov 15, 2005, 06:46 PM
 
Well I believe that march would equal ppc (not pentium) for Mac use, but if you would post the actual makefiles themselves, it would be helpful to see what they are trying to do. The code might be trying to do a lot of platform specific stuff (otherwise I don't see why they would specify the arch).
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Nov 16, 2005, 01:31 AM
 
It looks like maybe they're providing you with binary files (boltzmann.o) that the makefile is meant to link in, but the binaries are in the wrong executable format. Could that be the case?

It would be helpful to see the makefile.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
cdc  (op)
Fresh-Faced Recruit
Join Date: Sep 2005
Status: Offline
Reply With Quote
Nov 16, 2005, 02:30 AM
 
okay guys, here you go...
Thanks in advance!!!



CC = gcc
CLINKER = gcc

CFLAGS = -Wall -O4 -g -march=pentium
LIBS = -lm
DEPEND= makedepend

SRC = boltzmann.c
OBJS = boltzmann.o
EXECS = boltzmann

default: boltzmann

all: $(EXECS)

boltzmann:$(OBJS)
$(CLINKER) $(OPTFLAGS) -o ../Run/boltzmann $(OBJS) $(LIBS)

clean:
/bin/rm -f *.o *~ $(EXECS)

.c.o:
$(CC) $(CFLAGS) -c $*.c
     
cdc  (op)
Fresh-Faced Recruit
Join Date: Sep 2005
Status: Offline
Reply With Quote
Nov 16, 2005, 08:48 AM
 
problem solved!

I deleted the .o file, which was generated on a linux machine and leaved out the -march parameter. It compiled fine...

thanks for the comments!
     
   
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 07:42 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