anyone knows why this does not work when I try to include a library with the following declarations:
namespace wincabase
{
const char* SOMESTRING = "xx";
}
While this is perfectly fine:
namespace wincabase
{
const int X = 30;
}
I get a “multiple definitions” error with gcc for the first case when I link the lib. Thanks!
const char* means pointer to const char. This means the pointer itself is not constant.
Hence it’s a normal variable, so you’d need to use
in the header file, and
in one compilation unit of the library.
Alternatively, if it’s meant to be a const pointer to a const char, then you should use: