locked
Debugging information cannot be found or does not match

    Question

  • I wanted to try learnign some C++ with Visual C++ Express but when i try to build even the simplest program:

    #include <iostream>
    using namespace std;

    int main()
    {
        cout << "Hello world!\n";

        return 0;
    }

    I get the error below:
    Debugging information for "project.exe" cannot be found or does not match. Binary was not built with debug information.

    What does this exactly mean and how to fix it?
    Thanks.
    Wednesday, October 11, 2006 9:10 AM

Answers

  • To enable debugging:

    1) Goto Project->HelloWorld Properties
    2) On the left expand "Configuration Properties"
    3) Expand "C/C++"
    4) On the left, Select "General"
    5) On the right, change "Debug Information Format" to "Program Database For Edit And Continue (/ZI)"
    5) On the left, Select "Optimization"
    6) On the right, change "Optimization" to "Disabled (/Od)"
    7) On the left, expand "Linker"
    8) On the left, select "Debugging"
    9) On the right, change "Generate Debug Info" to "Yes"
    10) Click ok
    11) Set your breakpoints
    12) Rebuild your application

    Also when running your application use Ctrl+F5 to build and run it, this keeps the console window open long enough for you to see your output.
    Wednesday, October 11, 2006 11:06 AM

All replies

  • To enable debugging:

    1) Goto Project->HelloWorld Properties
    2) On the left expand "Configuration Properties"
    3) Expand "C/C++"
    4) On the left, Select "General"
    5) On the right, change "Debug Information Format" to "Program Database For Edit And Continue (/ZI)"
    5) On the left, Select "Optimization"
    6) On the right, change "Optimization" to "Disabled (/Od)"
    7) On the left, expand "Linker"
    8) On the left, select "Debugging"
    9) On the right, change "Generate Debug Info" to "Yes"
    10) Click ok
    11) Set your breakpoints
    12) Rebuild your application

    Also when running your application use Ctrl+F5 to build and run it, this keeps the console window open long enough for you to see your output.
    Wednesday, October 11, 2006 11:06 AM
  • Thank you for the reply. Seems that it helps. Why isn't that put that way from the beginning? Is there some adavantage for keeping debugging of as default?
    Wednesday, October 11, 2006 12:55 PM
  • No idea its a question i have often asked, i mean the compiler distinguishes between "debug" and "release" builds, why optimization is turned on and debugging is not in debug, by default is
     very strange.
    Wednesday, October 11, 2006 2:44 PM
  •  

    Just encounted the same issue.. the answer above pretty fixed it. thanks

    Thursday, February 08, 2007 4:02 AM
  • This method does work to enable debugging for the specific project. How can I get debug enabled for all projects in the future. I certainly dont want to have to change these settings per project.
    Tuesday, February 13, 2007 3:13 PM
  • Unfortunately you have to do this for each and every application.

    Dont ask me why microsoft decided to optimize in debug build, it seems very odd to me also.

    Tuesday, February 13, 2007 6:32 PM
  • The debugging steps outlined above were helpful.  However, for the current project I am working on, I had to make one additional change to get my program to debug properly.  Here are the steps I took:

    1) Open your Project Properties..

    2) On the left, expand Configuration Properties.

    3) Just beneath that, select "General" under Configuration Properties.

    4) On the right, change "Debuggable Assembly" to "Runtime tracking and disable optimizations (/ASSEMBLYDEBUG)"

    5) Click OK to save changes.

    The option that allows you to generate a map file for your project may also have been necessary, so if all of the above fails to allow you to debug your application, try setting "Generate Map File" to "Yes".  Sorry I can't verify this further at this time.

    Friday, February 23, 2007 1:04 AM
  • Hi

     

    Where's the "Configuration properties" on left? When I go to Project--My Project Properties, I just have:

    Application

    Compile

    Debug

    References

    Resources

    Settings

    Signing

    Security

    publish

     

    Thanks for help in advance

    Tuesday, April 24, 2007 10:39 AM
  • I had the same problem with debug and your advise helped me. The strange thing is that until now the projects were created with that feature turned on. Yesterday I received the same message: "Debugging information cannot be created...and so on". So maybe there is a way to return to the normal situation with debugging information created by default?
    Thursday, June 28, 2007 8:18 AM
  • THANK YOU iccle! couldnt work out why it was comming up with that message whenever i created a new project, ive been using the program a few weeks now but i had been editing a basecode project so when this error started comming up i thought id broke something!

    really wish those settings were default, is there any reason why we would want to use the orginal settings? and why oh y are we not told about these things when we first install, ive had it installed 3 months now, only got it working 2 weeks ago by installing SDKs and changing numerous settings but i had to get all this help off forums like this one! i just dont understand why things arn't made clearer, unless im just blind and it has told me and ive not noticed it! lol!

    Thank god for helpful people like you posting answers and solutions on forums, otherwise us newbies wouldnt ever get started, i think i might pay it forward now and look for a forum question i can answer! doubt ill find one though!

    -Thanks, Chris
    Monday, July 30, 2007 10:35 AM
  • Thx to iccle and Flash.

    I've had to do that before but I lost my cheat sheet. I don't get how I can do a dozen programs with no problems and every once in a while I have this debug problem. (I suspect that strcopy_s is the culprit.)

    Friday, September 28, 2007 9:42 PM
  • Make sure "Commad" and "Working Directory" both are correct. (ie Command in \debug and Working Directory usually where .sln file is located )
    Tuesday, November 06, 2007 7:53 PM
  •  

    massage is auto setting
    Wednesday, November 07, 2007 8:56 AM
  • C:\Program Files\Microsoft Visual Studio 8\VC\VCWizards\default.vcproj

    <?xml version="1.0"?>
    <VisualStudioProject ProjectType="Visual C++" Version="8.00">
        <Platforms>
            <Platform Name="Win32"/>
        </Platforms>
        <Configurations>
            <Configuration Name="Debug|Win32">
                <Tool Name="VCCLCompilerTool" Optimization="0" DebugInformationFormat="4"/>
                <Tool Name="VCLinkerTool" GenerateDebugInformation="true" />
            </Configuration>
            <Configuration Name="Release|Win32"></Configuration>
        </Configurations>
        <References/>
        <Files/>
        <Globals/>
    </VisualStudioProject>
    Tuesday, November 27, 2007 3:54 AM
  • you are a life saver Smile) thanks
    Tuesday, December 11, 2007 10:03 AM
  •  

    Tuesday, January 15, 2008 6:58 AM
  • Hi,

    I just had the same problem (Debugging information for "project.exe" cannot be found or does not match. Binary was not built with debug information.) but all recomended solutions don't fix my problem.

    In my situation, the only solution was to manualy kill the process mspdbsrv.exe and restart VS.
    Thursday, September 10, 2009 2:39 PM
  • Thanks a lot, I had a same problem. It helped a lot.
    Wednesday, January 27, 2010 8:23 PM
  • Thanks a lot. I too had the same problem. It fixed mine.
    Thursday, April 29, 2010 7:07 AM
  • Hello

     

    I had the same problem and I suppose I also could resolve it. But I got another problem. When I am running my code the vs ask the following in a window:

    "...Please specify the name of the executable file to be used for the debug session..."

    Should I give a file? which file? what is it?

     

    Thanks! Tamas

    Friday, November 26, 2010 8:27 PM
  • I followed the steps given by u  above but as soon as I changed the settings as mentioned above I have started getting the following error after rebuilding the solution . Please help to get rid of the following error.

    Command line error D8016 : '/ZI' and '/clr' command-line options are incompatible

     

    NOTE this error will not come if Debug Information format is "Program Database (/Zi) "

     

    Please help.

    Saturday, January 29, 2011 4:06 PM
  • The source file I used is as followswhen the error "error D8016 : '/ZI' and '/clr' command-line options are incompatible" occured. please help to remove this error

    //
    // Program to convert temperature from Celsius degree
    // units into Fahrenheit degree units:
    // Fahrenheit = Celsius * (212 - 32)/100 + 32
    //
    #include <stdio.h>
    #include <iostream>
    using namespace std;

    int main(int nNumberofArgs, char* pszArgs[])
    {
    // enter the temperature in Celsius
    int nCelsius;
    cout << "Enter the temperature in Celsius:";
    cin >> nCelsius;
    // calculate conversion factor for Celsius
    // to Fahrenheit
    int nFactor;
    nFactor = 212 - 32;
    // use conversion factor to convert Celsius
    int nFahrenheit;
    nFahrenheit = nFactor * nCelsius/100 + 32;
    // output the results
    cout << "Fahrenheit value is:";
    cout << nFahrenheit;
    return 0;
    }

    Saturday, January 29, 2011 4:09 PM
  • You chose the wrong project template to start with. Start over again, this time taking care to choose the "Win32 Console Application" project template.

    By the way, this question should have been posted in its own thread as a "new question".

    Saturday, January 29, 2011 6:45 PM
  • Just wanted to chime in and say that I had the same problem and this worked for me too.

     

    Thanks--

    Tuesday, October 11, 2011 9:24 PM
  • Not sure if this applies to VS 2005 or 2008, but I just get this with VS 2010 Ultimate, all set for debug (/Zi, pdb etc.). Strange was that debugger gave the same message running with F5 from IDE, but with a MessageBox for debug break and attach debugger, *sometimes* debugger attached recognized the breakpoints. But mainly it didn't worked out.

    After applying VS2010 SP1 - voilà! debugger worked correctly (no restart, no frills, just reopened VS IDE). So I will recommend you guys to install the latest SP (just a SP1, probably...) and, of course, set up the project for debugging (no matter if debug or release, just generate debug info for C++ and linker).

    Sunday, December 18, 2011 6:24 AM
  • I am facing a similar issue. I have an MS Project 2010 Addin which is developed in VS 2010. The debugging is working in one PC but in another PC, it shows the same error message

    and all the settings told above are already configured in this project. Can somoene tell me some a solution to this?


    Adeel

    Wednesday, November 21, 2012 12:36 PM