CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Debugging

Threaded View

  1. #1
    Join Date
    Jun 2008
    Posts
    32

    Debugging

    Hi, I'm having a couple problems debugging a VS2008 C++ app using this SFML graphics library.

    The first one is that when I edit a breakpoint through the When Hit menu and I try to have a variable print out through the output window using something like {value} nothing appears when the breakpoint is reached.


    The second more serious problem is that the debugger will only go through the first few breakpoints before exiting completely. The program will usually pop up a window where the graphics are and a plain text output window. When I use the debugger only the output window appears. I haven't detected any relevant problem with the program itself and the debugging works properly for a simple console program I tested.


    Code:
    int main()
    {
    //declare the characters and objects in window
    
    	
    	  object *ObjectArray[6];
    	//Wanderbot Basicbot(950.f,100.f,950.f,100.f);
    	hero firsthero(1000.f,300.f,1000.f,300.f);
    Peacebot Patrolbot(100.f,1900.f,100.f,1900.f);
    
    	weapon cpistol;
        collisionmachine collisionmachineinst;
        gameui currentui;
    	float distancebetweenxmain, distancebetweenymain,unsignedbx,unsignedby;
        sf::Clock Timer;
        // Create the main rendering window
        sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
    
    sf::Vector2f Center(400, 300);
    sf::Vector2f HalfSize(400, 300);
    sf::View View1(Center, HalfSize);
    
    
    
    
     //variables needed to run things on main
    
    collisionmachineinst.objectpopulation=5;
    
    //setup background

    <<BREAKPOINT>>//debugger exits out after this breakpoint


    Code:
    sf::Image Background;
        if  (!Background.LoadFromFile("PracticeDeck5test.png"))
            
        {
            std::cerr << "Error : cannot load image.\n";
            return EXIT_FAILURE;
        }
    
     sf::Sprite BackgroundSprite(Background);
    BackgroundSprite.SetPosition(0.f,0.f);
    
    
    //register objects in collision loop
    
     ObjectArray[0]=&firsthero;
     //ObjectArray[1]=&Basicbot;
     ObjectArray[1]=&cpistol.bullet[0];
     ObjectArray[2]=&cpistol.bullet[1];
     ObjectArray[3]=&cpistol.bullet[2];
    ObjectArray[4]=&Patrolbot;
    Last edited by Jarwulf; January 4th, 2010 at 01:29 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured