Messages in this thread |  | | Date | Sat, 18 May 1996 18:18:22 +0200 (MET DST) | From | Andreas Kostyrka <> | Subject | Re: strange gcc option, feature or bug? |
| |
On Fri, 17 May 1996, Y. Zhu wrote:
> Hi, all > I found a strange gcc option problem, here is the Makefile: > > CC = gcc -O2 > objs = foo.o > includedir = > CCFLAGS = -Wall -fno-strength-reduce > all: foo > $(objs): %.o: %.c > $(CC) -I$(includedir) -c $(CCFLAGS) $< -o $@ > foo: $(objs) > $(CC) -o $@ $(objs) > > the problem is due to _includedir_ having a null string. This Makefile can > produce at least two weird results according to the position of -Idir > option: > > 1. just like above Makefile, it makes error message: > > gcc -O2 -I -c -Wall -fno-strength-reduce foo.c -o foo.o This just means, that gcc should add -c to the include directories. (-c is a legal Unix filename!) > foo.c: In function `main': > foo.c:5: warning: unused variable `i' > gcc -O2 -o foo foo.o > foo.o(.data+0x0): multiple definition of `__environ' > /usr/lib/crt1.o(.data+0x0): first defined here > foo.o: In function `_init': > foo.o(.init+0x0): multiple definition of `_init' > /usr/lib/crti.o(.init+0x0): first defined here > foo.o: In function `_start': > foo.o(.text+0x0): multiple definition of `_start' > /usr/lib/crt1.o(.text+0x0): first defined here > foo.o: In function `_start': > foo.o(.text+0x0): multiple definition of `___crt_dummy__' > /usr/lib/crt1.o(.text+0x0): first defined here > foo.o: In function `_fini': > foo.o(.fini+0x0): multiple definition of `_fini' > /usr/lib/crti.o(.fini+0x0): first defined here > /usr/lib/libc.so(.dynamic+0x0): multiple definition of `_DYNAMIC' > /usr/lib/libc.so(.got.plt+0x0): multiple definition of `_GLOBAL_OFFSET_TABLE_' > make: *** [foo] Error 1 Seems like you have severe linking problems :( > > 2. if I put the -Idir option behind the -c option, it seems override the > next option -Wall, no warning!! but no error messages. > > gcc -O2 -c -I -Wall -fno-strength-reduce foo.c -o foo.o Now this just means add -Wall to the include directories. > gcc -O2 -o foo foo.o >
It is a bit weird, but it isn't a bug :)
Andreas
|  |