I am linking the following .cpp file to my program (approx. 800
modules), but the constructor is never called:
Foo.cpp:
#include <iostream>
static class Foo
{
public:
Foo() { std::cout << "Foo Constructor is called" << std::endl;}
} foo1;
If I am adding this code snippet to some other .cpp file with more
code and dependencies to other modules, the constructor is called. But
I don't understand why the constructor sometimes is called and
sometimes not. I am using g++ 3.4.6.
Is this a bug? Is there a work around?
Thanks