Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: J-C on May 02, 2011, 07:48:09 pm

Title: Debugging or Compiling and running
Post by: J-C on May 02, 2011, 07:48:09 pm
Ok I have searched not only here but over the internet, and so far I can't seem to find a solution...

The thing is I try debugging my game and a console shows for like 100 milliseconds? then just quits.

I CAN run the app on the debug folder and it works wonderful, but I want to Debug, and be able to run it with out going to the folder it is at... Any help is appreciated.
Title: Re: Debugging or Compiling and running
Post by: oBFusCATed on May 02, 2011, 09:20:45 pm
Can you describe exactly what you're doing? (please write all the steps you do)
Does debugging works with simple console project?
Title: Re: Debugging or Compiling and running
Post by: J-C on May 02, 2011, 09:23:32 pm
 What I do:

step 1: I have all my code and load all my files

step 2: code compiles and works fine.

step 3: if I try to compile and run, it compiles but when it runs it shows a DOS window and closes, same if I try to debug....

I don't know how to be clearer.
Title: Re: Debugging or Compiling and running
Post by: oBFusCATed on May 02, 2011, 09:30:56 pm
Try the console project :)

Also you can paste the full debugger's debug log from a debug session (after the debug -> start)?
The log should be enabled in settings->compiler & debugger -> debugger.
Use code tags, please.
Title: Re: Debugging or Compiling and running
Post by: J-C on May 02, 2011, 09:41:39 pm
I have this question before I do that, do I have to include, libraries and what not on the PROJECT build options as well, to be able to debug?
Title: Re: Debugging or Compiling and running
Post by: J-C on May 02, 2011, 09:48:25 pm
Code
Building to ensure sources are up-to-date
Build succeeded
Selecting target:
Debug
Adding source dir: C:\DarkQ\DarkQ\
Adding source dir: C:\DarkQ\DarkQ\
Adding file: bin\Debug\DarkQ.exe
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.8
Child process PID: 7100
Program exited with code 01.
Debugger finished with status 0
Title: Re: Debugging or Compiling and running
Post by: seb_seb0 on May 02, 2011, 09:50:59 pm
Program exited with code 01.
Debugger finished with status 0

apparently, your program is exiting with an error code. Have you tried to set a breakpoint at the 1st instruction of the program ?
Title: Re: Debugging or Compiling and running
Post by: J-C on May 02, 2011, 09:58:17 pm
I found out why... it exits when it is loading files? why is that? you can't load files while debugging?
Title: Re: Debugging or Compiling and running
Post by: oBFusCATed on May 02, 2011, 10:01:06 pm
You have problems with the paths probably.
You're assuming that the working this is <project>/bin/Debug, but when started from C::B the default is <project>.
See project properties for details.

For debugging with C::B read this: http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks
Title: Re: Debugging or Compiling and running
Post by: J-C on May 02, 2011, 10:05:54 pm
you were absolutely right sir, *face palm* it was the path, man I feel like a retard now... thanks a lot man :D, But it doesn't say anything on how to change the path?
Title: Re: Debugging or Compiling and running
Post by: seb_seb0 on May 02, 2011, 10:16:59 pm
you were absolutely right sir, *face palm* it was the path, man I feel like a retard now... thanks a lot man :D, But it doesn't say anything on how to change the path?

You are not alone, I had the exact same problem 3 month ago.
See the bright side: the debugger has helped you to find a mistake (not the way you planned, but still). It has done its job !
Title: Re: Debugging or Compiling and running
Post by: J-C on May 02, 2011, 10:22:51 pm
LOL yeah :P but how do I change or add the path to the images? or should I just copy them in the default folder?
Title: Re: Debugging or Compiling and running
Post by: oBFusCATed on May 02, 2011, 10:45:26 pm
project -> properties -> build targets

To not feel like a retard scroll around the menus, to see what features C::B has. There are some surprises :)
Title: Re: Debugging or Compiling and running
Post by: J-C on May 02, 2011, 10:56:19 pm
I did just that actually after posting that lol, but anyways for some reason it wasn't working but I got it, thanks again, C::B is new to me, I always used VC++ but I am Loving C::B :D