"Rolf Magnus" <ra******@t-online.de> wrote in message
news:cu*************@news.t-online.com...
cppsks wrote:
Taking the address of a static const resulted in a unresolved symbol.
What kind of static const? Where is it defined? How? Where do you take the
address?
Why is that?
Because a semicolon in line 42 is missing.
Is the address assigned at load time?
What do you mean by that?
"Rolf Magnus" <ra******@t-online.de> wrote in message
news:<cu*************@news.t-online.com>... cppsks wrote:
Taking the address of a static const resulted in a unresolved symbol.
What kind of static const? Where is it defined? How? Where do you take the
address?
Why is that?
Because a semicolon in line 42 is missing.
Is the address assigned at load time?
What do you mean by that?
Here is the code and the compilation issue:
#include <iostream>
class hi
{
public:
static const int constant = 10;
static void printMe(const int* a)
{
cout << "*a" << endl;
}
};
int main()
{
hi::printMe(&hi::constant);
}
:/>g++ addrStaticConst.cc
Undefined first referenced
symbol in file
hi::constant /tmp/ccyC1JeP.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status