🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: de.comp.lang.c++
Article #1047

statische Klassenkomponenten

#1047
From: Thomas Simon
Date: Tue, 19 Dec 1995 19:12
38 lines
973 bytes
 
Hallo Welt,
 
Ich habe versucht das folgende C++ Programm durch den gnu g++ version 2.6.0
zu jagen.
 
#include <iostream.h>
 
class A {
 
  public:
 
    static int k;
    static int give() { return k; };
 
};
 
 
int main()
{
  cout << A::give();
}
  
Und habe die folgende Fehlermeldung erhalten.
 
g++ -g -o test6 test6.cc
ld: Undefined symbol 
   __1A$k 
collect2: ld returned 2 exit status
 
 
Kann mir vielleicht jemand erklaeren, warum das nicht erlaubt ist ???
Oder ist dies erst bei einer hoeheren g++ Version erlaubt ??
 
Tschuess 
 
  Thomas
 
Technical Details
Message-ID: <1995Dec19.201232@alma.student.uni-kl.de>
Path: arc1-ca.pugleaf.net!alma.student.uni-kl.de!tsimon

Show Full Headers
Complete Article Headers
Newsgroups: de.comp.lang.c++
Path: arc1-ca.pugleaf.net!alma.student.uni-kl.de!tsimon
From: tsimon@student.uni-kl.de (Thomas Simon)
Subject: statische Klassenkomponenten
Message-ID: <1995Dec19.201232@alma.student.uni-kl.de>
Sender: tsimon@alma.student.uni-kl.de (Thomas Simon)
Organization: University of Kaiserslautern, Germany
X-Newsreader: xrn 7.02
Date: Tue, 19 Dec 1995 19:12:32 GMT