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

linker problem with c++ exception



Title: linker problem with c++ exception

if I build the following dummy test program I get undefined references to std::runtime_error.

any ideas?

thomas

#include <stdexcept>

int main()
{
        try
        {
                throw std::runtime_error("throw runtime_error exception");
        }
        catch (...)
        {
        }
        return (0);
}



Makefile:

AXIS_BUILDTYPE = cris-axis-linux-gnu
include /usr/local/axis/devboard_lx/apps/Rules.elinux

DIRS = .
PROGS = test

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

LDLIBS = -lstdc++

all: $(PROGS)

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

clean:
        rm -f $(OBJS) *~ core

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



Make Output:

gcc-cris -mlinux -isystem /local/home/schwere/Devel/msw/target/cris-axis-linux-gnu/include  -L/local/home/schwere/Devel/msw/target/cris-axis-linux-gnu/lib -s test.o -lstdc++ -o test

test.o: In function `main':
test.o(.text+0x2c): undefined reference to `runtime_error::runtime_error(basic_string<char, string_char_traits<char>, __default_alloc_template<false, 0> > const &)'

collect2: ld returned 1 exit status
make: *** [test] Error 1