Moving between areas

This is a discussion on Moving between areas within the C++ Programming forums, part of the General Programming Boards category; Is there specific conditions to run a debugger? My visual studio compile button is grayed out let alone debugging, and ...

  1. #31
    Registered User
    Join Date
    Jun 2009
    Location
    Adeliade, AU
    Posts
    128
    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

  2. #32
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    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...
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #33
    Registered User
    Join Date
    Jun 2009
    Location
    Adeliade, AU
    Posts
    128
    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

  4. #34
    Registered User
    Join Date
    Jun 2009
    Location
    Adeliade, AU
    Posts
    128
    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

  5. #35
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    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.
    Last edited by Elysia; 07-13-2009 at 06:04 AM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #36
    Registered User
    Join Date
    Jun 2009
    Location
    Adeliade, AU
    Posts
    128
    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?

  7. #37
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    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.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #38
    C++11 User Tux0r's Avatar
    Join Date
    Nov 2008
    Location
    Sweden
    Posts
    135
    Quote Originally Posted by Aliaks View Post
    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?
    Let me google that for you

  9. #39
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    This may be of help, too.
    Debugging Native Code FAQs
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #40
    Registered User
    Join Date
    Jun 2009
    Location
    Adeliade, AU
    Posts
    128
    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

    Code:
    		if (player.location->north)
    			cout << "(N)orth to: " << player.location->north->description << endl;
    Unlike my compiler I cant see any error messages.

  11. #41
    Registered User
    Join Date
    Feb 2009
    Posts
    37
    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; }
    };

  12. #42
    Registered User
    Join Date
    Jun 2009
    Location
    Adeliade, AU
    Posts
    128
    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

  13. #43
    C++11 User Tux0r's Avatar
    Join Date
    Nov 2008
    Location
    Sweden
    Posts
    135
    Quote Originally Posted by rossipoo View Post
    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; }
    };
    Code:
    class Room {
    	... blah blah blah
    
    	Room (): north(),south(),east(),west() {}
    };

  14. #44
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,538
    Quote Originally Posted by Aliaks View Post
    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

    Code:
    		if (player.location->north)
    			cout << "(N)orth to: " << player.location->north->description << endl;
    Unlike my compiler I cant see any error messages.
    If the debugger breaks, it will show you some diagnostics. Often it is access violation when you're dealing with pointers.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  15. #45
    Registered User
    Join Date
    Jun 2009
    Location
    Adeliade, AU
    Posts
    128
    Can
    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];
    go into headerfiles?

Page 3 of 7 FirstFirst 1234567 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stack overflow errors in 3 areas
    By ulillillia in forum C Programming
    Replies: 13
    Last Post: 04-29-2007, 03:20 PM
  2. Moving Average Question
    By GCNDoug in forum C Programming
    Replies: 4
    Last Post: 04-23-2007, 11:05 PM
  3. rescaling areas
    By hannibar in forum C Programming
    Replies: 2
    Last Post: 02-28-2006, 02:22 PM
  4. 3D moving
    By bluehead in forum C++ Programming
    Replies: 9
    Last Post: 04-02-2005, 04:46 AM
  5. Simple program i cant get (dot moving)
    By Lupusk9 in forum C++ Programming
    Replies: 4
    Last Post: 09-14-2004, 08:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21