Die Make-Datei funktioniert nicht?

Lösung gefunden. Siehe unten:

Ich versuche, mein makefile zum kompilieren von drei c-Programme in eine ausführbare Datei, aber ich bekomme die folgende Fehlermeldung:

cachesim.o: could not read symbols: File in wrong format

Ja, ich bin mit sauber machen jedes mal ich es verwenden. Die make-Datei ist wie folgt

CC     = gcc
CFLAGS = -Wall -m32 -O -g

all:  cachesim cache trace_file_parser 
gcc -o cachesim cachesim.o cache.o trace_file_parser.o

cachesim:       cachesim.c
        $(CC) -c -o cachesim.o cachesim.c $(CFLAGS)

cache:          cache.c
        $(CC) -c -o cache.o cache.c $(CFLAGS)

trace_file_parser:  trace_file_parser.c
        $(CC) -c -o trace_file_parser.o trace_file_parser.c $(CFLAGS)

clean:
rm -f *.o

Ich kann nicht herausfinden, warum das so ist....

Ich bin mit sauber machen jedes mal.

Versucht zu kompilieren:

[katiea@mumble-15] (34)$ make clean
rm -f *.o
[katiea@mumble-15] (35)$ ls
cache.c   cache.h     cachesim.c~      gcc_trace  Makefile~     trace_file_parser.c
cache.c~  cachesim.c  cache_structs.h  Makefile   strgen_trace  trace_file_parser.h
[katiea@mumble-15] (36)$ make
gcc -c -o cachesim.o cachesim.c -Wall -m32 -O -g
gcc -c -o cache.o cache.c -Wall -m32 -O -g
gcc -c -o trace_file_parser.o trace_file_parser.c -Wall -m32 -O -g
gcc -o cachesim cachesim.o cache.o trace_file_parser.o
cachesim.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [all] Error 1

LÖSUNG

CC     = gcc

CFLAGS = -Wall -m32 -O -g

all:  cachesim.c cache.c trace_file_parser.c
$(CC) -o cachesim cachesim.c cache.c trace_file_parser.c $(CFLAGS)

cachesim:       cachesim.c
        $(CC) -c -o cachesim.o cachesim.c $(CFLAGS)

cache:          cache.c
        $(CC) -c -o cache.o cache.c $(CFLAGS)

trace_file_parser:  trace_file_parser.c
        $(CC) -c -o trace_file_parser.o trace_file_parser.c $(CFLAGS)

clean:
rm -f *.o

InformationsquelleAutor katiea | 2013-11-25

Schreibe einen Kommentar