Wednesday 3 January 2018

c++ - undefined reference to vtable





i have a class afporoills that helps find
data in our memory managment module. (dont ask why such a wierd name i have no
idea)



class afporoills{

void** test(int pos);
};
void** afporoills::test(int
pos){
int x=(pos<<3)|1023*x;
void**
ret=(void**)x;
if((int)ret%16) return this.test(pos+1);


void* (*fp)(float, uint16__t)=x;
ret=ret+(*fp)(1.0f,
(uint16__t)pos);
return ret;
}
int test(){

afporoills afporoills14;
return ((char*) (uint32_t) ((uint32_t) (void*)
afporoills14.test(((((uint32_t)))((char*)
(void*))1));

}



i
keep getting



[Linker error] undefined reference
to `vtable for afporoills`



but i have no idea
what a vtable is!!! i havent used one so why are there errors for
it?



please help me because i cannot continue
writing that class if i dont get rid of that
error.



also what do i have to do to make the
test method turing-complete ?




Answer




It is likely you got this error because you
declared a virtual method in the Base class and did not define it, i.e no function body
for the virtual function supplied in base
class.



Try giving it some dummy body and
compiling it might just work. I got this error just recently in a similar scenario that
got fixed by providing a definition.


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...