[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C++ linking problems


I'm having trouble linking a simple C++ program with the latest compiler
and devboard software 1.00 for the 100LX.

I decided to create a very simple C++ program and see if I have the same
problem - and I do.

Here is the source code which I've placed into a file named "hello.cpp"

#include <stdio.h>

class hello
    printf("hello world\n");

    printf("goodbye world\n");

int main()
  hello t;

  return 0;

My current makefile looks like this:

include $(APPS)/Rules.elinux

DIRS = .

PROGS = hello

SRCS = $(patsubst %, %/*.cpp, $(DIRS))
SRCS := $(wildcard $(SRCS))
OBJS = $(patsubst %.cpp, %.o, $(SRCS))

CXXFLAGS += -nostdinc -I$(prefix)/include/uC-libc -Wall
CXXFLAGS += -Dlinux
LDFLAGS += -L$(prefix)/lib
LDLIBS = -lucc -lic -lgcc

all: $(PROGS)

$(PROGS):  $(OBJS)
        $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@

        rm -f $(OBJS) *~ core

        makedepend -Y -- $(CFLAGS) -- $(SRCS) 2>/dev/null


Here is the output

[root@bluetooth test]# make
gcc_cris -melinux -muclibc=/home/matthewh/axis/devboard_lx/eroot -s
-symbolic -L
/home/matthewh/axis/devboard_lx/eroot/lib  test.o -lucc -lic -lgcc -o hello

/home/matthewh/axis/devboard_lx/eroot/lib/uccrt0.o: In function `start1':
/home/matthewh/axis/devboard_lx/eroot/lib/uccrt0.o(.text+0x54): undefined
reference to `main'
test.o(.text+0xa): undefined reference to `printf'
collect2: ld returned 1 exit status
make: *** [bridged] Error 1

I've compiled C++ programs before using the old devboard 1.02 software with
1.07? compiler
without this trouble.   Can someone help.


Matt Hook.

CAUTION:  The information contained in this mail message is
confidential and may be legally privileged. No confidentiality
or privilege is waived or lost by any mistransmission. If the
reader of this message is not the intended recipient, you are
hereby notified that any use, dissemination, or reproduction of
this message is prohibited. If you have received this message in
error please notify the sender immediately by email and destroy
the original message. Thank you.