initializing a constant in the .h file?

anonymous_at_coolgroups.com
Date: 07/31/04


Date: Sat, 31 Jul 2004 11:29:58 GMT

hello,
i am attempting to initialize a constant in my .h file. it would be terrific if i
could also assign the constant, but i continue to get compile problems. this
is what i'm trying to do:

(in myfile.h)
   const std::string MY_CONSTANT = "permanent value";

but my compiler (gcc version 3.2.1) tells me:

   ISO C++ forbids initialization of member

any feedback is appreciated



Relevant Pages

  • Re: initializing a constant in the .h file?
    ... > i am attempting to initialize a constant in my .h file. ... > could also assign the constant, but i continue to get compile problems. ... Is there any reason why this is a problem? ...
    (comp.lang.cpp)
  • Re: ICU4R 0.1.0 - initial release
    ... Alex, thank you for pointing this bug. ... I had no compile problems with GCC 3.4.2, GCC 4.0 and MSVC++ 7.1, so ...
    (comp.lang.ruby)