Article View: gnu.g++.help
Article #41static vals inside a class are unresolved (g++ 2.0/SunOS4.1.1)
From: Elliott McCrory
Date: Thu, 09 Apr 1992 21:16
Date: Thu, 09 Apr 1992 21:16
42 lines
1875 bytes
1875 bytes
How has the use of "static" changed since g++ 1.39? I have a
situation like this:
% cat world.cxx
#include <std.h>
#include <stream.h>
class Foo {
static int a;
public:
Foo(int c) { a=c ; f=0.0; };
int b() { return a; };
static float f;
};
int main(int argc, char* argv[])
{
Foo A(1);
cout << A.b() << "Hello world\n" << A.f << "\n";
}
% make -k world
g++ -g -Dsun4 -DEBUG -o world world.cxx
world.cxx:7 (world.o): Undefined symbol __3Foo$a referenced from text segment
world.cxx:7 (world.o): Undefined symbol __3Foo$a referenced from text segment
world.cxx:7 (world.o): Undefined symbol __3Foo$f referenced from text segment
world.cxx:7 (world.o): Undefined symbol __3Foo$f referenced from text segment
world.cxx:8 (world.o): Undefined symbol __3Foo$a referenced from text segment
world.cxx:8 (world.o): Undefined symbol __3Foo$a referenced from text segment
world.cxx:15 (world.o): Undefined symbol __3Foo$f referenced from text segment
world.cxx:15 (world.o): Undefined symbol __3Foo$f referenced from text segment
*** Error code 1
make: Warning: Target `world' not remade because of errors
Compilation finished at Thu Apr 9 16:13:14
Thanks in advance.
--
|| Elliott McCrory, Ph. D. | mccrory@tomato.fnal.gov (internet)
-/ \- Fermi National Accelerator Lab | ALMOND::MCCRORY (DECnet)
-\ /- Batavia, IL 60510 | MCCRORY@FNALAD (BITnet)
|| 708-840-4808 | linac!tomato!mccrory (uucp)
Technical Details
Message-ID:
<MCCRORY.92Apr9161630@tomato.fnal.gov>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!linac!tomato!mccroryShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!linac!tomato!mccrory From: mccrory@tomato.fnal.gov (Elliott McCrory) Newsgroups: gnu.g++.help Subject: static vals inside a class are unresolved (g++ 2.0/SunOS4.1.1) Message-ID: <MCCRORY.92Apr9161630@tomato.fnal.gov> Date: 9 Apr 92 21:16:31 GMT Sender: mccrory@tomato.fnal.gov Distribution: gnu Organization: Fermilab, Batavia, IL Lines: 42