C
Chameleon
The following code produces strange errors in mingw.
Is a C++ problem or compiler problem?
----------------------------
#include <list>
class A
{
static const int B = 0;
std::list<int> lst;
void calc();
};
void A::calc()
{
lst.push_back(B); // produces 'undefined reference to A::B'
int a = B;
lst.push_back(a); // its ...ok!
}
int main() { return 0; }
----------------------------
Is a C++ problem or compiler problem?
----------------------------
#include <list>
class A
{
static const int B = 0;
std::list<int> lst;
void calc();
};
void A::calc()
{
lst.push_back(B); // produces 'undefined reference to A::B'
int a = B;
lst.push_back(a); // its ...ok!
}
int main() { return 0; }
----------------------------