Hi,
I got the following compiling/linking error, but I have no
clue what it is about.
Can anybody help me?
thanks, daniel g++ inheritance.cc
/tmp/ccVdAhtt.o: In function `A::A[not-in-charge]()':
/tmp/ccVdAhtt.o(.gnu .linkonce.t._ZN 1AC2Ev+0x8): undefined reference to
`vtable for A'
/tmp/ccVdAhtt.o: In function `A::~A [not-in-charge]()':
/tmp/ccVdAhtt.o(.gnu .linkonce.t._ZN 1AD2Ev+0x8): undefined reference to
`vtable for A'
/tmp/ccVdAhtt.o(.gnu .linkonce.d._ZT I1B+0x10): undefined reference to
`typeinfo for A'
collect2: ld returned 1 exit status g++ --version
g++ (GCC) 3.2.2
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
cat inheritance.cc
#include <map>
class A{
public:
A(){;};
~A(){;};
virtual int doit();
};
class B:A{
int b;
public:
B(){b=-1;};
B(int x){b=x;};
int doit(){return b;};
};
using namespace std;
int main(){
/*
map<int,class B> Bs;
for (int x=0;x<10;x++){
Bs[x]=B(x*x);
}
for (map<int,B>::it erator IT=Bs.begin();I T!=Bs.end();IT+ +){
fprintf(stdout, "Bs[%d]=%d\n",IT->first,IT->second.doit()) ;
}
*/
class B Bs1;
Bs1=B(23);
fprintf(stdout, "Bs[%d]=%d\n",23,Bs1.d oit());
return 0;
}
-- thanks, daniel 1 8475
Daniel Heiserer wrote: Hi,
I got the following compiling/linking error, but I have no clue what it is about.
Can anybody help me?
thanks, daniel
Sure. Please see below.g++ inheritance.cc
First of all, TURN UP YOUR WARNINGS! (sorry for yelling ;-))
It will save you much grief in the long run. /tmp/ccVdAhtt.o: In function `A::A[not-in-charge]()': /tmp/ccVdAhtt.o(.gnu .linkonce.t._ZN 1AC2Ev+0x8): undefined reference to `vtable for A' /tmp/ccVdAhtt.o: In function `A::~A [not-in-charge]()': /tmp/ccVdAhtt.o(.gnu .linkonce.t._ZN 1AD2Ev+0x8): undefined reference to `vtable for A' /tmp/ccVdAhtt.o(.gnu .linkonce.d._ZT I1B+0x10): undefined reference to `typeinfo for A' collect2: ld returned 1 exit status
g++ --version g++ (GCC) 3.2.2 Copyright (C) 2002 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
cat inheritance.cc
#include <map>
class A{ public: A(){;};
Spurious trailing `;'
~A(){;};
Spurious trailing `;'
Non-virtual destructor! (Classes from which you inherit - that have
virtual functions - need a virtual destructor.)
virtual int doit();
No implementation of this function?
}; class B:A{ int b; public: B(){b=-1;}; B(int x){b=x;}; int doit(){return b;}; };
using namespace std; int main(){ /* map<int,class B> Bs; for (int x=0;x<10;x++){ Bs[x]=B(x*x); } for (map<int,B>::it erator IT=Bs.begin();I T!=Bs.end();IT+ +){
fprintf(stdout, "Bs[%d]=%d\n",IT->first,IT->second.doit()) ; } */ class B Bs1; Bs1=B(23); fprintf(stdout, "Bs[%d]=%d\n",23,Bs1.d oit()); return 0; }
-- thanks, daniel
Turning up your warnings is _always_ a good idea; compiler warnings are
usually much better (and more comprehensible) than linker errors by
themselves (as the former relate to source code).
HTH,
--ag
--
Artie Gold -- Austin, Texas This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Pani |
last post by:
Hi
I am new to C++ ,i really dont understand why there is a need for
VTable and can some experts give an example where exactly and how a compiler
uses it
Regards
Pani
|
by: r |
last post by:
I compile this on a Max OSX with
GCC version 1151, based on gcc version 3.1 20020420
g++ foo.cpp
ld: Undefined symbols: <-- ERROR
vtable for Foo
Any idea why?
-r
**************** contents of foo.cpp **********
|
by: Nolan Martin |
last post by:
Hello, I was wondering if it were possible to access the vtable directly.
Are there any resources that detail the inner workings of the vtable?
|
by: alessandro |
last post by:
Compiling my current project I received the following error:
undefined reference to `vtable for Tuner'
The only two things I know are that the error occours when trying to invoke
the constructor of a class and that concerns virtual functions.
What does it mean?
|
by: Foolster41 |
last post by:
I'm rather new to C++ programing. I'm using the dev-C++ program on a
windows XP OS. I'm trying to compile the code for a multi user dungeon
(MUD) called circle-mud.
When I compile I get the following errors:
----
Compiler: Default compiler
Building Makefile: "C:\EvoMud\circle-3.1\src\Makefile.win"
Executing make...
| |
by: Florian Xaver |
last post by:
Hi!
I got the following errors from the linker (using latest version of
DJGPP and gcc/gpp). But, why are the operators
undefined????
Any ideas?
.../../lib/djgpp.v2/libSWORD.a(spy.o):spy.cc:(.text+0x120): undefined
reference t
|
by: Matthias Kaeppler |
last post by:
Hi,
I'm confronted with an error here I haven't encountered before (g++ 3.3.5):
Building duality.elf ...
obj_dbg/mainwindow.o(.gnu.linkonce.t._ZN14TransferDialogC1EN5boost10shared_ptrI4TaskEE+0x5c):
In function
`TransferDialog::TransferDialog(boost::shared_ptr<Task>)':
/usr/include/c++/3.3/bits/sstream.tcc:57: undefined reference to `vtable
for TransferDialog'
|
by: cjeschke |
last post by:
Using PRO*C precompiler on windows, I precompile my c code with embedded Oracle 9.2 queries. When I link the program including all the Oracle 9.2 libraries I can find, i get an undefined _sqlcxt:
>make
gcc -oreplaceCard.exe -lm -LC:\oracle\ora92\precomp\lib -LC:\oracle\ora92\oci\lib\msvc -IC:\oracle\ora92\oci\include -IC:\oracle\ora92\precomp\public replaceCard.c
c:/djgpp/tmp/ccsIViCl.o(.text+0x58a):replaceCard.c: undefined reference to...
|
by: vfunc |
last post by:
I get an undefined reference error for a definition that clearly looks
like it is in a .h file. So
what can be the cause of an undefined reference error, when this .h
file containing the definition has been included and the namespace has
been declared.
I blame engineers they are all ponsey zealots.
|
by: TOMERDR |
last post by:
Hi,
I am looking for an article which explain how the keywords new,override
atc..
change if at all the VTABLE and how VTABLE implemented by .NET
thanks in advance
Tomer
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |