Wednesday 15 February 2012

Compile program using a Makefile with gcc instead of clang -



Compile program using a Makefile with gcc instead of clang -

i writing programme spell-check given text. on pc used makefile compile program:

# compiler utilize cc = clang # flags pass compiler cflags = -ggdb3 -o0 qunused-arguments -std=c99 -wall -werror # name executable exe = speller # space-separated list of header files hdrs = dictionary.h # space-separated list of source files srcs = speller.c dictionary.c # automatically generated list of object files objs = $(srcs:.c=.o) # default target $(exe): $(objs) $(hdrs) makefile $(cc) $(cflags) -o $@ $(objs) $(libs) # dependencies $(objs): $(hdrs) makefile

i go on programming on raspberry pi have gcc installed. possible create makefile work gcc? tried alter compiler with:

cc = gcc

but doesn't work. error message "unrecognised alternative -qunused-arguments".

the problem -q alternative clang accepts isn't alternative gcc recognises.

gcc , clang separate compilers, , 1 shouldn't expect 1 of them understand other's options. in fact, clang create efforts modestly compatible gcc, in big part create possible utilize drop-in replacement gcc. compatibility isn't, , shouldn't be, complete.

so solution alter cflags definition @ same time alter cc definition.

makefile

No comments:

Post a Comment