Article View: gnu.g++.help
Article #397Re: static member
From: Brendan Kehoe
Date: Mon, 28 Sep 1992 13:51
Date: Mon, 28 Sep 1992 13:51
35 lines
1319 bytes
1319 bytes
In article <CBT.92Sep25151617@yosemite.inesc.pt> cbt@yosemite.inesc.pt (Conceicao Batista Tavares) writes:
I have the following program:
#include <iostream.h>
class xpto {
public:
static int c;
int f;
};
main ()
{
xpto B;
cout << B.c <<endl;
}
And when I try to compile it I get this message:
----
ld:
Undefined:
_4xpto$c
collect: /usr/bin/ld returned 1 exit status
----
You're only providing a declaration of the member; somewhere you have
to provide a definition. (e.g., "int xpto::c = 0;")
--
Brendan Kehoe brendan@cygnus.com
Cygnus Support, Palo Alto, CA +1 415 322 3811
Re-elect Clinton/Gore in '96!
Technical Details
Message-ID:
<35710@hoptoad.uucp>Path:
arc1-ca.pugleaf.net!sparky!uunet!hoptoad!brendanReferences:
<CBT.92Sep25151617@yosemite.inesc.pt>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!hoptoad!brendan From: brendan@cygnus.com (Brendan Kehoe) Newsgroups: gnu.g++.help Subject: Re: static member Message-ID: <35710@hoptoad.uucp> Date: 28 Sep 92 13:51:21 GMT References: <CBT.92Sep25151617@yosemite.inesc.pt> Sender: news@hoptoad.uucp Reply-To: brendan@cygnus.com Distribution: gnu Organization: Cygnus Support, Palo Alto, CA Lines: 35 Nntp-Posting-Host: cygnus.com In-reply-to: cbt@yosemite.inesc.pt's message of 25 Sep 92 15:16:17 GMT