Author Topic: Debugging or Compiling and running  (Read 4005 times)

Offline J-C

  • Single posting newcomer
  • *
  • Posts: 8
Debugging or Compiling and running
« 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12001
    • Travis build status
Re: Debugging or Compiling and running
« Reply #1 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?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline J-C

  • Single posting newcomer
  • *
  • Posts: 8
Re: Debugging or Compiling and running
« Reply #2 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12001
    • Travis build status
Re: Debugging or Compiling and running
« Reply #3 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline J-C

  • Single posting newcomer
  • *
  • Posts: 8
Re: Debugging or Compiling and running
« Reply #4 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?

Offline J-C

  • Single posting newcomer
  • *
  • Posts: 8
Re: Debugging or Compiling and running
« Reply #5 on: May 02, 2011, 09:48:25 pm »
Code: [Select]
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

Offline seb_seb0

  • Almost regular
  • **
  • Posts: 166
Re: Debugging or Compiling and running
« Reply #6 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 ?

Offline J-C

  • Single posting newcomer
  • *
  • Posts: 8
Re: Debugging or Compiling and running
« Reply #7 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?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12001
    • Travis build status
Re: Debugging or Compiling and running
« Reply #8 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
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline J-C

  • Single posting newcomer
  • *
  • Posts: 8
Re: Debugging or Compiling and running
« Reply #9 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?
« Last Edit: May 02, 2011, 10:11:54 pm by J-C »

Offline seb_seb0

  • Almost regular
  • **
  • Posts: 166
Re: Debugging or Compiling and running
« Reply #10 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 !

Offline J-C

  • Single posting newcomer
  • *
  • Posts: 8
Re: Debugging or Compiling and running
« Reply #11 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?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12001
    • Travis build status
Re: Debugging or Compiling and running
« Reply #12 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 :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline J-C

  • Single posting newcomer
  • *
  • Posts: 8
Re: Debugging or Compiling and running
« Reply #13 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