473,394 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

referencing

Hello
in my header file i've:
class CSimpEngine : public CEngine
{

CSimpEngine()
{
....
}

i get here the error: undefined reference to `vtable for CSimpEngine'
and in my class CEngine i've:

class CEngine
{
public:
CEngine() {}
~CEngine() {}
};
What am i doing wrong? What is vtable?
THANKS and regards
Michael
Sep 11 '05 #1
5 1180
"Michael Sgier" <sg***@nospam.ch> wrote in message
news:43**********************@news.sunrise.ch
Hello
in my header file i've:
class CSimpEngine : public CEngine
{

CSimpEngine()
{
...
}

i get here the error: undefined reference to `vtable for CSimpEngine'
and in my class CEngine i've:

class CEngine
{
public:
CEngine() {}
~CEngine() {}
};
What am i doing wrong? What is vtable?
THANKS and regards
Michael


You won't get that error from the code you have shown. Show us real code
that exhibits the problem.

--
John Carson

Sep 11 '05 #2
Michael Sgier wrote:
Hello
in my header file i've:
class CSimpEngine : public CEngine
{

CSimpEngine()
{
...
}

i get here the error: undefined reference to `vtable for CSimpEngine'
and in my class CEngine i've:

class CEngine
{
public:
CEngine() {}
~CEngine() {}
};
What am i doing wrong? What is vtable?
THANKS and regards
Michael


That error usually happens because you declared a virtual function but
forgot to define it.

But there are no virtual functions in the code you posted. If you want
help with code it always helps to post the actual code, instead of the
pieces of the code that you think might be relevant.

Of course this doesn't mean that you should post pages and pages of
code. Instead when you have an error you don't understand, spend some
time to create the smallest possible program that still has the error
you don't understand, then post the whole program. Not only will this be
a good learning exercise for you it also ensures that you will get your
questions answered promptly and accurately.

john
Sep 11 '05 #3
Hello again
in Main.cpp i've:
CSimpEngine* MyCSimpEngine = new CSimpEngine;

and i've added in simpengine.cpp this:
CSimpEngine::CSimpEngine()
{
gameCamera = new CCamera;
}

CSimpEngine::~CSimpEngine()
{
delete gameCamera;
gameCamera = NULL;
}

do i need to do that? I have the declaration in simpengine.h as in my
previous mail.
and i still get the same error:
main.o(.gnu.linkonce.t._ZN11CSimpEngineC1Ev+0x1b): In function
`CSimpEngine::CSimpEngine[in-charge]()':
/home/michael/Desktop/div.OpenGL/agentin_laura/src/simpengine.h:32:
undefined reference to `vtable for CSimpEngine'
THANKS Michael
Sep 11 '05 #4
Maybe like this it's clearer. My simpengine.h:

class CSimpEngine : public CEngine
{
public:
CSimpEngine()
{
gameCamera = new CCamera;
}

~CSimpEngine()
{
delete gameCamera;
gameCamera = NULL;
}
};
Sep 11 '05 #5
"Michael Sgier" <sg***@nospam.ch> wrote in message
news:43**********************@news.sunrise.ch
Maybe like this it's clearer. My simpengine.h:

class CSimpEngine : public CEngine
{
public:
CSimpEngine()
{
gameCamera = new CCamera;
}

~CSimpEngine()
{
delete gameCamera;
gameCamera = NULL;
}
};


This is completely useless. Read what John Harrison wrote.

1. Simplify the code as far as you can while still getting the error.
2. Then supply us with the EXACT and COMPLETE code from 1. that you run
through the compiler.

Since you appear to have some psychological resistance to doing what is
necessary, let me make two points.

First, you don't know what the problem is otherwise you wouldn't be posting
here. That means that you don't know where in your code the problem is and
hence your attempts to select relevant code are very likely to fail.

Second, your attempts to select relevant code have in fact failed. Consider
the following code, which consists of everything you have posted, plus a few
other details that I have filled in. It compiles without any errors. Thus
the problem is not in the code you have posted. Don't waste any more time
supplying selected excerpts.

#include <cstdlib>

class CEngine
{
public:
CEngine() {}
~CEngine() {}
};

class CCamera
{};

class CSimpEngine : public CEngine
{
public:
CSimpEngine()
{
gameCamera = new CCamera;
}

~CSimpEngine()
{
delete gameCamera;
gameCamera = NULL;
}
private:
CCamera *gameCamera;
};

int main()
{
CSimpEngine* MyCSimpEngine = new CSimpEngine;
return 0;
}

--
John Carson

Sep 11 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: xcomm | last post by:
Hi All, <?php $vars= array("_SERVER","_SERVER","_SERVER","_SERVER","_SERVER","_SERVER"); foreach($vars as $var) { if(isset($$var))echo("$var: ${$var}<br>\n"); } ?> php.net:
1
by: student | last post by:
while compiling on: SunOS 5.8 Generic_108528-27 sun4u sparc SUNW,Sun-Fire-280R I get the following error: Undefined first referenced symbol ...
2
by: sreddy | last post by:
I am trying to write a sql query on self referencing table. Just to brief ..Database is related to a Hiring department of the Qwest company. I need to generate a Report used by in HR...
2
by: Simon | last post by:
Am using the following code. <script language="JavaScript1.2"> function setquantity(productindex,productquantity) { //create the reference object irefname_none = eval("document." +...
6
by: jstaggs39 | last post by:
I want to create a Dcount and an If...Then...Else statement to count the number of records in a table based on the date that is entered to run the form. The If....Else statment comes in because if...
6
by: Mikey_Doc | last post by:
Hi We are running cms 2002, Framework 1.0 with Visual studio 2002. We have just upgraded to Framework 1.1 and visual studio 2003. All of our database connection strings are stored within the...
3
by: gary | last post by:
Hi, I am trying to reference an anchor in a user control with a url. This worked in 1.1 but no longer works in 2.0. The ascx control is located in a "/include" folder If you have a...
9
by: Brett Romero | last post by:
Say I have a library (A.dll) with a method that accepts a collection of a specific type. The type is defined in B.dll. In A.dll, I need to loop through this collection and reference fields of...
1
by: Tim F | last post by:
Problem: I'm receiving the error "File or assembly name XXXXX or one of its dependencies, was not found." when trying to execute code in an assmebly that has both a strong-name and has been...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.