EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

error msg: main.o: undefined reference to '_impure_ptr'

Started by yazhi_1 March 19, 2004
I'm using a embeddedGnu IDE program that uses
gnu-m68hc11 to compile my code.
My code works okay without this function added:

void my_print ( char *msg) {
while(msg != 0)
putchar (*msg++);
}

But when i add it to my code i get these errors:

main.o: undefined reference to '_impure_ptr'
main.o: undefined reference to '_swbuf'
------------

here's my make file:
OC = c:/usr/bin/m6811-elf-objcopy
CC = c:/usr/bin/m6811-elf-gcc
RM = C:/embeddedGNU/rm.exe

CFLAGS = -m68hc11 -O3 -fno-ident -fno-common
-fomit-frame-pointer -mshort -fsigned-char
LDFLAGS = -Wl,-u,-mm68hc11elfb
OCFLAGS = -O srec

CSRCS=main.c

OBJS=$(CSRCS:.c=.o)

all: ourProject.elf ourProject.s19

$(OBJS): %.o: %.c
$(CC) $(CFLAGS) -c $<

ourProject.elf: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o ourProject.elf $(OBJS)

ourProject.s19: ourProject.elf
$(OC) $(OCFLAGS) ourProject.elf ourProject.s19

clean:
$(RM) -f ourProject.elf
$(RM) -f ourProject.s19
$(RM) -f ourProject.dmp
$(RM) -f $(OBJS) ---------------
The weird thing is, that if I put this function by
itself without my other functions in another main.c
file and run make. It works and builds my files okay.

I only get this error when i add this function into my
main.c.
nf



The 2024 Embedded Online Conference