Reputation: 13172
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
Upvotes: 1
Views: 1062
Reputation: 3490
Another possible case is the output has been cached, and the process crash after enter main, please add flush output here after the out put line, or you can reapte print it 1000 times to make sure it doesn't cached.
In that case, the easy way is to run it in debugger, it will cache the error.
Upvotes: 0
Reputation: 122393
The problem is probably in some global class varible's constructor. They will be called before main
.
Upvotes: 5