Thread: Problem with debugging in Visual Express 2010

  1. #1
    Registered User
    Join Date
    May 2012

    Problem with debugging in Visual Express 2010

    First of all let me specify that I'm working with programs consisting of 2 .cpp files, one with the main() and another one with a class. I'm still very new to programming in general. Running Win 7 32bit.

    I have a problem that sometimes, when I debug a program, then make some changes to it and debug again, the program is still the same as before the changes where made. I can save the file and close VS, reopen it, debug and it's still the old code; I have to copy and paste the code into a new project so I can see the changes.

    When I try to debug using the step over and step into functions when the program goes to the cpp containing the class and it will say that "the source file is different from when the module was built. Would you like the debugger to use it anyway?", it gives me the option to either go use it anyway or browse to a file; wheter I browse to the file or say to "use it anyway" the arrow will point that it's executing lines where the code WAS before the changes, it can execute lines with nothing on them or lines with commented code, completely skipping any new code added that should be executed.

    Let me add the I only work inside VS's project folder, I just create new project and add cpps in source files, I don't save and load cpps all over the place, all files are always in the same project folder.

    When I hit build solution it will constantly say that the code is up to date, and the problem sometimes fixes itself after a few more changes and debugs.

    This is really getting on my nerves, I asked my professor and he said that it has never happened to him; it's just too hard to code when you barely know any coding and sometimes the debug is showing you stuff you supposedly already fixed, most of the time when my code doesn't work I don't know if my fixes aren't working or if VS is showing me the program from before the fixes where made.

    Sorry for wall of text. Hope someone can help me. I already did my googling but only found other people with the same problem and no solutions. I can't switch to other compiler since it's mandatory that I use VS2010. Thanks.
    Last edited by tombmonkey; 05-03-2012 at 09:19 PM.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Try rebuilding instead of just building the project.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Visual C++ 2010 Express Windows Form problem
    By Huzapro0 in forum C++ Programming
    Replies: 4
    Last Post: 08-10-2011, 05:24 AM
  2. Visual C++ 2010 Express Portable Programs
    By Bronx68 in forum C++ Programming
    Replies: 18
    Last Post: 08-01-2011, 03:54 PM
  3. C project in Microsoft Visual C++ 2010 Express?
    By alexbcg in forum C Programming
    Replies: 2
    Last Post: 12-08-2010, 02:39 PM
  4. Debugging loops in Micosoft Visual C++ 2010 Express
    By Kat007 in forum C++ Programming
    Replies: 4
    Last Post: 09-23-2010, 06:59 PM
  5. Visual C++ 2010 express problems
    By dnj23 in forum Windows Programming
    Replies: 6
    Last Post: 08-10-2010, 06:16 AM