Hi somenath (and Alf and Victor)!
On Thursday, January 2, 2014 10:15:57 AM UTC-5, Alf P. Steinbach wrote:
> On 02.01.2014 10:22, somenath wrote:
> > I am not able to understand why the following program does not compile.
> > ...
> > Whenever I try to compile the program I get the following error
> > g++ LocalClass.cpp
> > /tmp/ccfEKvyT.o:LocalClass.cpp:(.text+0x2b): undefined reference to `i'
> > collect2: ld returned 1 exit status
>
> This is known g++ bug, already reported at
>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52688
> As a workaround you can pass the referenced static variable as an
> argument, or maybe move it inside the class, or ...
>
> Cheers & hth.,
> - Alf
I tried this with my copy of g++.
For what it's worth, your code compiles and runs fine
when I compile it with a mingw-w64 version of g++:
C:\>g++ --version
g++ (rubenvb-4.8-stdthread) 4.8.1 20130324 (prerelease)
Happy New Year Hacking!
K. Frank