| View previous topic :: View next topic |
| Author |
Message |
Nine_Masquerade_
Joined: 18 Jun 2009 Posts: 26
|
Posted: Sun Aug 09, 2009 1:47 pm Post subject: undefined reference to `vtable'? |
|
|
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 |
|
 |
slasher2661996
Joined: 22 Feb 2009 Posts: 91 Location: Melbourne Australia ZOMG
|
Posted: Sun Aug 09, 2009 2:30 pm Post subject: |
|
|
| Shop shop = new Shop(); |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Sun Aug 09, 2009 8:53 pm Post subject: |
|
|
| 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 |
|
 |
slasher2661996
Joined: 22 Feb 2009 Posts: 91 Location: Melbourne Australia ZOMG
|
Posted: Sun Aug 09, 2009 11:00 pm Post subject: |
|
|
| really? i was reading the error wrong, sorry :/ |
|
| Back to top |
|
 |
|