Re: error: undefined reference to
From: Alwyn (dt015a1979_at_mac.com.invalid)
Date: 11/03/04
- Next message: Alwyn: "Re: Design: String search or multiple implementation static location - possibly OT"
- Previous message: Gergely Buday: "error: undefined reference to"
- In reply to: Gergely Buday: "error: undefined reference to"
- Next in thread: Gergely Buday: "Re: error: undefined reference to"
- Reply: Gergely Buday: "Re: error: undefined reference to"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 03 Nov 2004 18:33:44 +0000
In article <ffb12a90.0411031001.3b6a73ed@posting.google.com>, Gergely
Buday <gergoe@math.bme.hu> wrote:
> Hi,
>
> I'm having a problem compiling my program (that is part of a large one):
>
> libDummyTools.so: undefined reference to `MyClass::p_Instance'
>
> nm says
>
> $ nm DummyTools/.obj/MyClass.o |grep p_Instance
> U _13MyClass.p_Instance
>
> What can cause this behaviour?
>
> MyClass.h:
> ---
> class MyClass
> {
> private:
> static MyClass* p_Instance
> ...
> public:
> static MyClass* getInstance();
>
>
> MyClass.cpp:
> ---
Your static variable needs to be defined outside the class definition.
Insert here:
MyClass *MyClass::p_Instance;
HTH
Alwyn
- Next message: Alwyn: "Re: Design: String search or multiple implementation static location - possibly OT"
- Previous message: Gergely Buday: "error: undefined reference to"
- In reply to: Gergely Buday: "error: undefined reference to"
- Next in thread: Gergely Buday: "Re: error: undefined reference to"
- Reply: Gergely Buday: "Re: error: undefined reference to"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]