Visual C++ Developer Center > Visual C++ Forums > Visual C++ General > Confused about the file structure of VC++ solutions
Ask a questionAsk a question
 

AnswerConfused about the file structure of VC++ solutions

  • Tuesday, November 03, 2009 11:03 PMLKeene Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello all,

    I'm experiencing absolutely bizarre behavior when trying to debug my app. When I place a breakpoint in a location in one of my files the debugger won't break even though it is on a valid line. If I pick another location, the debugger breaks but then seems to move around randomly when I step through my code. For example, if I have a nested if/else-if/else-if/ block, when stepping through with the debugger I notice that code inside all the if-else conditional blocks is visited (!), some lines are skipped for no apparent reason, just general craziness. It's as if the environment was debugging another file and not the one I see being stepped through on the screen.

    Out of desperation I started looking closely at the files generated by the Visual Studio wizard and noticed that my Dll project has the following structure:

    c:\MyDllProject->MyDllProject

    The outer "MyDllProject" folder contains an inner "MyDllProject" folder as well as "Debug" and "Release" folders. It also contains my source files. The inner "MyDllProject" folder, however, also contains "Debug" and "Release" fodlers. Why do I have 2 pairs of Debug/Release folders? I should also note that I am using the Intel C++ plug-in.

    Thanks in advance.
    -Confused

Answers

  • Wednesday, November 04, 2009 1:24 AMScott McPhillipsMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    The bizarre behavior for debugger stepping is normal if you are debugging a release build.  It should not happen when debugging a debug build.
  • Wednesday, November 04, 2009 3:16 AM«_Superman_»MVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    As Scott said, there is heavy optimization done in release mode.
    So some lines of your code have been either eliminated or optimized by the compiler.

    You can still step through you code in release mode if you turn off optimization in the project properties in the C/C++ -> Optimization and Linker -> Optimization.

    «_Superman_»
    Microsoft MVP (Visual C++)

All Replies

  • Wednesday, November 04, 2009 1:24 AMScott McPhillipsMVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    The bizarre behavior for debugger stepping is normal if you are debugging a release build.  It should not happen when debugging a debug build.
  • Wednesday, November 04, 2009 3:16 AM«_Superman_»MVPUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    As Scott said, there is heavy optimization done in release mode.
    So some lines of your code have been either eliminated or optimized by the compiler.

    You can still step through you code in release mode if you turn off optimization in the project properties in the C/C++ -> Optimization and Linker -> Optimization.

    «_Superman_»
    Microsoft MVP (Visual C++)