Static members in C++

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Regicide

Thread Starter
Joined
Aug 8, 2003
Messages
307
I'm having troble with static members of a class.
Code:
class Test
{
public:
      static int X;
};

int main()
{
      Test::X = 6;
      return 1;
}
Anytime I do that, or make a instance of the class, it gives me the following error: :main.obj : error LNK2001: unresolved external symbol "public: static int Test::X" ([email protected]@@2HA)". Even when I don't reference X, it still gives me that error. Anyone have any answers.

p.s. I'm using Visual C++, Windows 98SE
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top