Is there specific conditions to run a debugger? My visual studio compile button is grayed out let alone debugging, and my Codeblocks ill compile, but the entire debug list is grayed out
Printable View
Is there specific conditions to run a debugger? My visual studio compile button is grayed out let alone debugging, and my Codeblocks ill compile, but the entire debug list is grayed out
In Visual Studio, you must create a project and add your source files to it first.
If you haven't compiled your project before trying to debug, it will ask you to do so first.
I don't know enough of Code::Blocks to help with anything there...
Ah yep, Cool it works now, never really used visual studio before so I didnt know it had to be in a project file.
thanks
Is there a place wherre I can learn about debugging and its messages?
I have a few errors in debugging but they dont mean much to me atm
None that I know of, but if you post the errors here, I and others can assist.
Then again, there are probably many debugging tutorials on the web, if you search hard enough.
Well im not sure what to look at, there are lots of tabs and + grouped menus
What is the main part I need to look at?
Some basic things:
- Breakpoints (Hoykey: F9): A breakpoint will stop execution of code once it reaches the breakpoint.
- Step in (F11): Executes one line of code.
- Step over (F10): As above, but it does not step into functions. It simply executes the function and halts afterwards.
- Step out (Shift + F11): Executes all code until the end of the current function.
You can hover the mouse over variables to see their contents.
The Auto window will show relevant variables in your code in the context of the current line of code.
Watch window is a tab in the Auto window. This window allows you to add certain variables whose value you want to watch.
To the right is the Call stack. This shows which function has called which and you can also double-click on the function names to jump back a function or so.
Access violation - if the debugger says this, it usually means that you have tried to access a pointer which is invalid.
Perhaps this helps a bit.
Also, the shortcuts is of the VC6 keyboard scheme. You can change this under tools -> options -> keyboard.
This may be of help, too.
Debugging Native Code FAQs
Well I looked through that and Ive googled some pages, but it doesn't tell me what to look at, all I can tell is it breaks at line 66
so im guessing there is something wrong with
Unlike my compiler I cant see any error messages.Code:if (player.location->north)
cout << "(N)orth to: " << player.location->north->description << endl;
Oh, that probably means that the linked rooms are not being initialized to zero. It was working for me in GCC, but it wasn't really proper coding; I should have added it before. To initialize them, add this line to the Room class:
Code:class Room {
... blah blah blah
Room () { north = 0; south = 0; east = 0; west = 0; }
};
Ah I see, that makes sence and yes it runs now and I can use it :)
I geeeet it now hahah now I can see how I can move from room to room, I can't thank you enough for showing me this method.
Thanks for everyones help as well :)
Cango into headerfiles?Code:// Create four rooms.
Room *rooms = new Room [4];
rooms[0].description = "Room 1";
rooms[1].description = "Room 2";
rooms[2].description = "Room 3";
rooms[3].description = "Room 4";
// Connect room 1 and room 2.
rooms[0].east = &rooms[1];
rooms[1].west = &rooms[0];
// Connect room 2 and room 3.
rooms[1].north = &rooms[2];
rooms[2].south = &rooms[1];
// Connect room 2 and room 4.
rooms[1].south = &rooms[3];
rooms[3].north = &rooms[1];