help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strange link problem


From: Fei Liu
Subject: Re: strange link problem
Date: 7 Mar 2006 14:23:06 -0800
User-agent: G2/0.2

arcimboldo@gmail.com wrote:
> Hello,
>
> I got a strange link problem; here are the simplest files showing the
> error:
>
> a.h::
>   #include <utility>
>
>   class a{
>    public:
>     typedef int perm;
>     static const perm PERM_NONE = 0;
>     a();
>   private:
>     std::pair<int, perm> aaa;
>   };
>
> a.cpp::
>   #include "a.h"
>   a::a() : aaa(0,PERM_NONE) { }
try a::a(): aaa(0, a::PERM_NONE){}
>   main () { }
>
> Compiling with g++ (GCC) 3.3.5 (Debian 1:3.3.5-13) I get::
>
>   $ g++ a.cpp
>   /tmp/ccKKUXg8.o: In function
> `a::a[not-in-charge]()':a.cpp:(.text+0xa): undefined reference to
> `a::PERM_NONE'
>   /tmp/ccKKUXg8.o: In function `a::a[in-charge]()':a.cpp:(.text+0x34):
> undefined reference to `a::PERM_NONE'
>   collect2: ld returned 1 exit status
>
> The file compiles correctly, the error shows up only when linking.
> 
> What could it possibly be? Thanks for any help!
> 
> Arcimboldo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]