Search code examples
c++crashprogram-entry-point

My program exits before entering the main() function


What could be the cause for a program to crash/exit before entering the main() function?

I am working on a project that was running normally. I added some code that uses boost threads, I updated the makefiles (CMakeLists.txt), and everything compiles and links without issues.

When I launch the executable, all I get is the prompt.

To check if the programs starts doing something, I add a cerr << "TEST" << endl as the first instruction in main(), and nothing is printed.

Of course when I try to print that string no threads are created, yet.

Putting a break point at the beginning of main() is useless.

System:
Windows 7, MinGW, GCC, cmake


Solution

  • The problem is probably in some global class varible's constructor. They will be called before main.