Author Topic: Weird console issue  (Read 5502 times)

Offline CopperCAT

  • Single posting newcomer
  • *
  • Posts: 6
Weird console issue
« on: January 25, 2010, 08:27:01 pm »
Recently I dug up an old SDL project I would like to finish.

So, I installed CodeBlocks svn build rev 6088 (2010-01-15 13:16:56) on my Debian box. After some initial fiddling to get x86-64 binaries, I could get the Debug version to work.

However, for the Release version, when I change the application type from Console to GUI, my app won't run anymore. My SDL window appears (the right size as well) but stays blank and sits there. Pressing the Abort button does nothing, I have to do a "kill -9" from a terminal for it to disappear. Changing back to Console and it runs fine again...

It might be an SDL issue as well, I really don't know anymore. Its driving me nuts...

Anyone have an idea?

Offline CopperCAT

  • Single posting newcomer
  • *
  • Posts: 6
Re: Weird console issue
« Reply #1 on: January 26, 2010, 12:32:47 am »
I noticed that when starting the app in gdb/debug mode, there's no problem at all :? It does not make sense to me...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Weird console issue
« Reply #2 on: January 26, 2010, 06:59:37 am »
I noticed that when starting the app in gdb/debug mode, there's no problem at all :? It does not make sense to me...
This most likely points to issues in your code. In debug build the memory footprint is layout different (safely) so that memory leaks often will not occur.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline CopperCAT

  • Single posting newcomer
  • *
  • Posts: 6
Re: Weird console issue
« Reply #3 on: January 26, 2010, 10:02:06 am »
I noticed that when starting the app in gdb/debug mode, there's no problem at all :? It does not make sense to me...
This most likely points to issues in your code. In debug build the memory footprint is layout different (safely) so that memory leaks often will not occur.

That might be true, but why doesn't it happen when enabling the console window? That option does not change anything in the compiled code...

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Weird console issue
« Reply #4 on: January 26, 2010, 10:10:52 am »
That option does not change anything in the compiled code...
There is. Look at the linker options. They are different (and that's exactly what the options does).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline CopperCAT

  • Single posting newcomer
  • *
  • Posts: 6
Re: Weird console issue
« Reply #5 on: January 26, 2010, 10:28:44 am »
There is. Look at the linker options. They are different (and that's exactly what the options does).

Wait, so I do this: I go to Project > Properties > Build targets and for "Type" I choose "GUI application". I then press "Rebuild". App displays window but seems to hang. Then, I go to properties again, and choose "Console application". I *only* press "Run". App works.

Thus, at least the linker executed as well the second time?

Edit: I noticed that the problem seems to be that when setting type to GUI application, "SDL_Flip(Surface)" does not return.


« Last Edit: January 26, 2010, 10:32:00 am by CopperCAT »

Offline CopperCAT

  • Single posting newcomer
  • *
  • Posts: 6
Re: Weird console issue
« Reply #6 on: January 26, 2010, 06:23:19 pm »
Ok, another test. If I make a shortcut on my KDE desktop to my app, it also runs fine without console. So now I really feel convinced this is a codeblocks issue.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Weird console issue
« Reply #7 on: January 26, 2010, 06:58:17 pm »
You can try to create a test sdl app with the wizard, and look for difference(s) in the setup, because it works out of the box.

Offline CopperCAT

  • Single posting newcomer
  • *
  • Posts: 6
Re: Weird console issue
« Reply #8 on: January 27, 2010, 09:58:09 am »
You can try to create a test sdl app with the wizard, and look for difference(s) in the setup, because it works out of the box.

The setups are the same, but the example application from the wizard runs fine.

I guess I'll leave it like that. The problem exists only when running from within codeblocks so it does not really matter in the end user version...