Author Topic: Windows program built in Codeblocks/MinGW exiting immediately when run  (Read 3634 times)

Miserableman

  • Guest
Hi again, back so soon :0)

I've managed to build the program I was having trouble with before. It's a Windows GUI program, but when I run it it terminates immediately - it doesn't show up in Task Manager, even for a split-second. Furthermore, I tried to debug it and even if I put a breakpoint on the first line of the WinMain function, the debugger doesn't catch it. I put a msgbox call MessageBox (NULL, "Hello", "Hello Demo", MB_OK); as the first line of the program and even a call to "return 2;", but each time it would exit with code 0. Clearly it's not even getting as far as calling WinMain. Does anybody know what could be going wrong? The build process includes the -mwindows flag, beyond that I'm out of ideas :S

Miserableman

  • Guest
Re: Windows program built in Codeblocks/MinGW exiting immediately when run
« Reply #1 on: November 12, 2005, 11:16:02 pm »
I think I've found the problem - the project uses some external libraries like libpng and libjpeg that I've had to build myself, and I've indvertently built the various test programs that come with each package into the libs. I guess when it all gets linked together, the program is running from one of the other main()'s. I still haven't got it working (I think I'm going to have to go back and look at all the libs I've built) but I'm pretty sure this is the problem.