forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

undefined reference to `vtable'?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Nine_Masquerade_



Joined: 18 Jun 2009
Posts: 26

PostPosted: Sun Aug 09, 2009 1:47 pm    Post subject: undefined reference to `vtable'? Reply with quote

When compiling i get this error log:


**** Build of configuration Default for project ITAWAS ****

make all
psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150 -L. -LC:/pspsdk/psp/sdk/lib main.o graphics.o framebuffer.o -lpspgu -lpng -lz -lm -lstdc++ -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o hello.elf
main.o: In function `main':
main.cpp:(.text+0x7c): undefined reference to `vtable for Shop'
main.cpp:(.text+0x84): undefined reference to `vtable for Shop'
collect2: ld returned 1 exit status
make: *** [hello.elf] Error 1

here is how i declared shop in main.c:
Code:

   Shop *shop;
   shop = new Shop;


Here is Shop.h:

Code:
#pragma once
#include <string>
#include <vector>

//#include "Player.h"


class Shop
{
public:
   Image *BG;
   Image *img;

   int WIDTH;
   int Y;
   int X0;

   int X1;

   int X2;

   int X3;

   int X4;

   bool firstPass;

   int xCoordinates[5];
   bool inventory[5][10];
   int costs[5][10];
   int arrowCoords[5][10];

   int left;

   int right;

   int still;

   int dir;

   int current;

   int dis;

   int choice;
   int selectedUpgrade;
   int numUp;

   std::string side;


   //0 = image, 1 = stats

   std::vector<Image*> shotgun;

   std::vector<Image*> minigun;

   std::vector<Image*> uzi;

   std::vector<Image*> flamethrower;

   std::vector<Image*> dragown;

   std::vector<Image*> money;
   Image *pointer;
   Image *incr;


   std::vector<std::vector<Image*>*> weapon;


   std::vector<Image*> upgrades;

   std::vector<Image*> display;

   //Arrows 0,1 = Left 2,3 = Right

   std::vector<Image*> arrow;


   std::vector<Image*> fist;

   std::vector<Image*> heart;

   Shop();
//
   virtual void draw();
//
   virtual bool act(bool L, bool R, bool U, bool D, bool E, bool esc);
};


Here is Shop.cpp:

Code:

#include "Shop.h"

Shop::Shop()
{
code
}

void Shop::draw()
{
code
}

bool Shop::act(bool L, bool R, bool U, bool D, bool E, bool esc)
{
code
}


Thanks for any help.
Back to top
View user's profile Send private message
slasher2661996



Joined: 22 Feb 2009
Posts: 91
Location: Melbourne Australia ZOMG

PostPosted: Sun Aug 09, 2009 2:30 pm    Post subject: Reply with quote

Shop shop = new Shop();
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Sun Aug 09, 2009 8:53 pm    Post subject: Reply with quote

slasher2661996 wrote:
Shop shop = new Shop();


I'm sorry but :
Code:
Shop *shop = new Shop;
is perfectly valid and should not be the issue. And you're plainly wrong without "*".

@OP: It seems Shop.o is missing in your OBJS flag (Makefile), so it cannot resolve the address of your VMT which is normally defined in Shop.o.
Back to top
View user's profile Send private message
slasher2661996



Joined: 22 Feb 2009
Posts: 91
Location: Melbourne Australia ZOMG

PostPosted: Sun Aug 09, 2009 11:00 pm    Post subject: Reply with quote

really? i was reading the error wrong, sorry :/
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group