Reputation: 81
I have a class where in the constructor, I simply do: printf("Hello"); If I make an instance of that class outside of the main() function, "Hello" does not pop up in my debug menu. However if I make an instance of the class inside of the main() function, "Hello" does indeed pop up.
Why does it have to be created inside of the main() function? Is there a way I can make it work when I put it outside of the main() function?
SomeClass instance;
int main(){
}
Compared to:
int main(){
SomeClass instance;
}
Upvotes: 2
Views: 1841
Reputation: 612844
For the static instance of the class I imagine the constructor runs before the debug console is ready to receive output from printf
. This sort of code is probably very implementation specific.
Upvotes: 3