My code has gotten large enough that I've had to split it into different object files. unfortunatly, I'm having difficulty resolving linker errors
here is the error(list) it gives:
ld: warning: cannot find entry symbol _start; defaulting to 00000000080486fc
main.o(.text+0xed): In function `loop()':
: undefined reference to `operator new(unsigned int)'
main.o(.text+0x147): In function `loop()':
: undefined reference to `operator delete(void*)'
main.o(.text+0x161): In function `loop()':
: undefined reference to `_Unwind_Resume'
main.o(.text+0x135c): In function `itemcreate(char*, char, int)':
: undefined reference to `operator new(unsigned int)'
main.o(.text+0x1587): In function `monster::monster(bool)':
: undefined reference to `operator new(unsigned int)'
main.o(.text+0x15ed): In function `monster::monster(bool)':
: undefined reference to `operator new(unsigned int)'
main.o(.text+0x161e): In function `monster::monster()':
: undefined reference to `operator new(unsigned int)'
main.o(.text+0x1650): In function `monster::monster()':
: undefined reference to `operator new(unsigned int)'
main.o(.text+0x169d): In function `monster::~monster()':
: undefined reference to `operator delete(void*)'
main.o(.text+0x16d9): In function `monster::~monster()':
: undefined reference to `operator delete(void*)'
main.o(.text+0x1c99): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init()'
main.o(.text+0x1ca1): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `__dso_handle'
main.o(.text+0x1cca): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init()'
main.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
mapgen.o(.text+0x8f3): In function `drunkTerrain(cell (*) [200], int, int)':
: undefined reference to `_Unwind_Resume'
mapgen.o(.text+0xcfe): In function `drunkTerrain(cell (*) [200], int, int)':
: undefined reference to `_Unwind_Resume'
mapgen.o(.text+0xefd): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init()'
mapgen.o(.text+0xf05): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `__dso_handle'
mapgen.o(.text+0xf2e): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init()'
mapgen.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
make: *** [nimrl] Error 1
Here is my makefile
nimrl:
g++ -c -omain.o nimrl.cpp
g++ -c -omapgen.o mapgen.cpp
ld -onimrl -lncurses main.o mapgen.o
and here is the function loop mentioned in the error
int loop() //loop
{
char in;
int xoff,yoff,i;
cell map[mapmaxx][mapmaxy];
monster* pc = new monster(1);
pc->x=100;
pc->y=100;
pc->hp=10;
pc->symbol='@';
centermap(pc->x,pc->y,xoff,yoff);
mapgen(map,0);
centermap(pc->x,pc->y,xoff,yoff); //big:5,5,20
drawmap(map,maxx,maxy,xoff,yoff);
while (1)
{
input(pc,map);
out.print();
centermap(pc->x,pc->y,xoff,yoff);
drawmap(map,maxx,maxy,xoff,yoff);
mvprintw(pc->y-yoff+1,pc->x-xoff,"@");
move(pc->y-yoff+1,pc->x-xoff);
}
delete pc;
}
Thanks in advance
ps. How do oyu get code listings into a white box?
[Edited by - NIm on July 18, 2005 10:05:14 AM]