Article View: de.comp.lang.c++
Article #953Problem mit Templates + Archiven/Libraries (CC 4.0.1)
From: 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/
---------------------------------------------------------------------------
----
Technical Details
Message-ID:
<4a20p9$173@fbi-news.Informatik.Uni-Dortmund.DE>Path:
arc1-ca.pugleaf.net!Informatik.Uni-Dortmund.DE!pirx!dittrichShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!Informatik.Uni-Dortmund.DE!pirx!dittrich From: dittrich@pirx.informatik.uni-dortmund.de (Peter Dittrich) Newsgroups: de.comp.lang.c++ Subject: Problem mit Templates + Archiven/Libraries (CC 4.0.1) Date: 5 Dec 1995 17:50:33 GMT Organization: CS Department, Dortmund University, Germany Sender: dittrich@pirx (Peter Dittrich) Distribution: world Message-ID: <4a20p9$173@fbi-news.Informatik.Uni-Dortmund.DE> NNTP-Posting-Host: pirx.informatik.uni-dortmund.de