Thread View: de.comp.lang.c++
1 messages
1 total messages
Started by Peter Dittrich
Tue, 05 Dec 1995 17:50
Problem mit Templates + Archiven/Libraries (CC 4.0.1)
Author: Peter Dittrich
Date: Tue, 05 Dec 1995 17:50
Date: Tue, 05 Dec 1995 17:50
135 lines
3818 bytes
3818 bytes
Hi,
ich bin auf ein seltsames Problem beim
SPARCompiler CC (V. 4.0.1) gestossen.
Es handelt sich dabei um ein Problem aus der
Kategorie "Templates + Archive/Libraries".
Ich bin fuer jeden Literaturhinweis bzw. Link zum Thema
"Templates + Archive/Libraries" dankbar.
Sagt der designierte ANSI-Standard was dazu ?
Hier nun das konkrete Problem:
--------------------------------------------------------------
// main.c
#include "Test.h"
main()
{
Test t;
t.print();
return 0;
}
---------------------------------------------------------------
"Test" ist eine Klasse, die als ein privates Element ein
"dictionary<unsigned long, char *>" hat. (Aus der LEDA-Lib,)
---------------------------------------------------------------
// Test.h
#include <LEDA/dictionary.h>
class Test
{
dictionary<unsigned long, char *> d ;
public:
Test();
void print();
};
---------------------------------------------------------------
Uebersetz man das mit :
CC main.c -lL -ltest -ptv -o main
-lL : LEDA-Lib.
-ltest : Lib. der Methoden fuer die Klasse "Test"
-ptv : verbose mode
So wird auch ein "dictionary<unsigned long, char*>::__vtbl" instantiiert:
template manager : Information: Processing template options file
"Templates.DB/Template.opt".
.../dictionary.h", line 62: Information: Instantiating dictionary<unsigned
long, char*>::__vtbl.
Erweitert man nun die Deklaration von "Test" um den
Destruktor "~Test()", also :
---------------------------------------------------------------
// Test.h
#include <LEDA/dictionary.h>
class Test
{
dictionary<unsigned long, char *> d ;
public:
Test();
~Test(); /* <<<<<<<<===== */
void print();
};
---------------------------------------------------------------
Und versucht das zu uebersetzen, so wird NICHT mehr ein
"dictionary<unsigned long, char*>::__vtb" instantiiert !!
WARUM ?
Beim Linken gibt's dann einen "Undefined symbol" Fehler:
template manager : Information: Processing template options file
"Templates.DB/Template.opt".
tdb_link : Information: Processing template options file
"Templates.DB/Template.opt".
tdb_link : Information: Invoking: "/usr/local/CC-4.0.1/SC3.0.1/bin/CC -o
main -ptv -ptl main.o -lL -ltest".
ld: Undefined symbol
skiplist::clear(void)
skiplist::skiplist(float)
dictionary<unsigned long, char*>::__vtbl
[Hint: try checking whether the first non-inlined, non-pure virtual
function of class dictionary<unsigned long, char*> is defined]
skiplist::~skiplist(void)
Vielen Dank fuer jede Hilfe,
Peter
--
------------------------------------------------------------------------------
Peter Dittrich E-mail:
dittrich@LS11.informatik.uni-dortmund.de
University of Dortmund Tel.: +49 231 9700
956
Dept. of Computer Science Fax.: +49 231 9700
959
Chair of Systems Analysis Office: ICD, R.
2.60
D-44221 Dortmund, Germany
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
http://ls11-www.informatik.uni-dortmund.de/people/dittrich.html/
---------------------------------------------------------------------------
----
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads