Thread: Visual C++ 2005 Express Edition: Breakpoints not working

  1. #1
    Registered User
    Join Date
    Feb 2006
    Posts
    15

    Visual C++ 2005 Express Edition: Breakpoints not working

    I realize that breakpoint is a useful feature in VC++ 2005 EE and have tried it in a test program. However, in a project I am writing, the breakpoint feature does not work.

    After I set a breakpoint and start the debug window, the breakpoint icon becomes hollow and states:

    The breakpoint will not currently be hit. No symbols loaded for this document.

    The project I am doing has two classes I created along with the main class. So far, the entire project is just below 400 lines and the backbone of this program almost set.

    I will gladly provide more information if needed.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Did you build for "debug" or "release" ?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Feb 2006
    Posts
    15
    Debug

  4. #4
    Tropical Coder Darryl's Avatar
    Join Date
    Mar 2005
    Location
    Cayman Islands
    Posts
    503
    The breakpoint will not currently be hit...
    That's your answer right there. The breakpoint won't be reached... for example
    Code:
    if (false)
    {
         int a = 100; <----- This code will never be reached! So setting a breakpoint is useless
    }

  5. #5
    Registered User
    Join Date
    Feb 2006
    Posts
    15
    Well I would've comprehended the error message had the error not occur every line I tested with breakpoints...

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    You also might have the wrong file open, or perhaps that code isn't built with the current project, or some other issue. This often happens to me when I open the same file but in a previous version (in a different directory), or when code is conditionally removed from compilation through precompiler directives.

    Basically, unless there is something wrong with your debugger setup, that code in that file will never be reached in your program. One way to test is to step through the program from the beginning until you reach a line of code that is giving you trouble. When you get to that line of code, try to set the breakpoint.

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    How about starting with a simple main printing "hello world" and see if you can set a breakpoint on that.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    Registered User
    Join Date
    Feb 2006
    Posts
    15
    The Hello World program did not work. However, a user from another forum suggested changing some of my settings in the Project Configuration:

    C/C++ -> General -> Debug Information Format: Program Database for Edit & Continue
    C/C++ -> Optimization -> Optimization: Disabled

    Linker -> General -> Enable Incremental Linking: Yes
    Linker -> Debugging -> Generate Debug Info: Yes

    Now breakpoints do work, but I'm going to have to learn to use it better :P

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  2. Compile Error in Visual C++ 2005 express
    By Fremontknight1 in forum C++ Programming
    Replies: 9
    Last Post: 10-19-2007, 04:28 PM
  3. Help: Microsoft Visual Basic 2005 Express Editon
    By karlawarla in forum Windows Programming
    Replies: 5
    Last Post: 11-22-2006, 02:46 PM
  4. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 04:49 AM
  5. Using 'if' with char arrays or string objects
    By c++_n00b in forum C++ Programming
    Replies: 36
    Last Post: 06-06-2002, 09:04 PM