| View previous topic :: View next topic |
| Author |
Message |
JustChris
Joined: 03 Nov 2005 Posts: 21
|
Posted: Tue Jan 17, 2006 9:37 am Post subject: "New" operator is undefined |
|
|
I can't seem to use much of STL because most of them use the 'new' and 'delete' operators. In fact, just dynamically allocating objects gives me the error.
| Code: | int *ptr;
ptr = new int[10];
// error returned
main.cpp:(.text+0x5a30): Undefined reference to 'operator new[](unsigned int)'
|
Is there something that I forgot to link against? Here is the makefile used.
| Code: |
TARGET = Test
OBJS = main.o sprite.o psp-setup.o sprite-rgba.o map1-rgba.o sprite-mono.o
INCDIR =
CFLAGS = -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
LIBS = -lglut -lGL -lm -lpsprtc
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Testing
PSP_EBOOT_ICON = test.png
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
AS=psp-as
psp-setup.o: psp-setup.c Makefile
psp-setup.o: CFLAGS += -DMODULE_NAME="$(TARGET)"
sprite.o: sprite.cpp sprite.h
main.o: main.cpp sprite.h
%.o: %.raw
(sym=`echo $* | tr '-' '_'`; \
echo -e ".data\n.global $${sym}_start\n$${sym}_start:\n\t.incbin \"$<\"" | $(AS) -o $@)
%-rgba.raw: %-rgba.png
convert $< rgba:$@
%-mono.raw: %-mono.png
convert $< gray:$@
%-sys.o: %.c
gcc -g -Wall -DSYS -c -o $@ $<
sys: test-sys.o sprite-sys.o sprite-mono.o sprite-rgba.o
gcc -o sys $^ -lglut
|
EDIT: NVM, it got fixed! I didn't add -lstdc++ to LIBS. |
|
| Back to top |
|
 |
sandberg
Joined: 05 Oct 2005 Posts: 90 Location: Denmark
|
Posted: Wed Jan 18, 2006 2:39 am Post subject: |
|
|
Link with stdc++
-lstdc++ to your LIBS variable in your makefile. That should do it. _________________ Br, Sandberg |
|
| Back to top |
|
 |
|