[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: g++ bug
From: |
Thomas Maeder |
Subject: |
Re: g++ bug |
Date: |
Mon, 17 Apr 2006 14:08:55 +0200 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) |
"matrut" <matrut@gmail.com> writes:
> class CSignal
> {
> public:
> CSignal(void)
> {
> m_this = this;
> };
>
> ~CSignal(void);
>
> protected:
> static CSignal *m_this;
> }:
Syntax error. Please next time post real code.
> and after linking the output is af follows:
>
> : undefined reference to `CService::m_this'
>
> The code works on Visual Studio C++ and what's the matter about g++?
The matter is that g++ is correct and Visual Studio C++ isn't.
The line
static CSignal *m_this;
declares m_this, but doesn't define it. You have to add a definition
of that variable to your program.
> What's the sollution?
Fix your code.