Re: Static Const

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

 



Paine, Thomas Asa wrote:
I am trying to declare a static const member like this...

   class RemoteManager:public Runnable{
   ...
    public:
     ...
-->  static const char MANAGEMENT_INTERFACE[] = "127.0.0.1";
     ...
   };

but when compiling, keep getting this...

g++ -g -Wno-deprecated -I /downloads/xerces/xerces-c-src_2_3_0/include/
-c remotemanager.cpp
In file included from remotemanager.cpp:7:
remotemanager.h:15: invalid in-class initialization of static data
member of
   non-integral type `const char[]'
make: *** [remotemanager.o] Error 1

I'm missing something small here, but I'm not seeing it.  Seems to be
object related because the same line of code in a simple main() function
works fine.  Thoughts?
Read section 9.4.2 paragraph 4 of the std

I'll precis it for you 'in-class initialization of static data member of
non-integral types are not permitted' :)

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
         The voices in my head said this was stupid too
nathan@xxxxxxxxxxxxxxxx    ::     http://www.planetfall.pwp.blueyonder.co.uk



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux