Search code examples
debuggingvisual-studio-2008visual-studio-debugging

Why can't I step into my library source code in a C++ project?


I have a small C++ program that uses a DLL. The program and DLL are in the same solution, and both are written using Visual Studio 2008. I am not able to step into the library's source code. I have the linker set for debugging in both projects.

The library compiler command line is:

/I "../CapsData" /I "../CapsLib" /I "../Include" /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "GREAT_LAKES_EBNER" 
/D "SKIP_SITE_H" /D "DEPLOYMENT_PLANLIB" /D "DEBUG" /D "_WINDLL" /D "_AFXDLL" /D "_UNICODE" /D "UNICODE" 
/FD /EHsc /MDd /Fo"Debug GLW Ebner\\" /Fd"Debug GLW Ebner\vc90.pdb" /nologo /c /TP /errorReport:prompt

The library linker command line is:

/OUT:"../Debug GLW Ebner\DeploymentPlanLib.dll" /NOLOGO /LIBPATH:"../Debug GLW Ebner/Lib" /DLL /MANIFEST 
/MANIFESTFILE:"Debug GLW Ebner\DeploymentPlanLib.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' 
uiAccess='false'" /DEBUG /PDB:"q:\CAPS\trunk\Debug GLW Ebner\DeploymentPlanLib.pdb" /DYNAMICBASE /NXCOMPAT 
/IMPLIB:"../Debug GLW Ebner/Lib/DeploymentPlanLib.lib" /ERRORREPORT:PROMPT CapsLib.lib CapsData.lib

The main program compiler command line is:

/Od /I "../CapsLib" /I "../Include" /I "../DeploymentPlanLib" /I "../CapsData" /D "WIN32" /D "_DEBUG" 
/D "_CONSOLE" /D "GREAT_LAKES_EBNER" /D "SKIP_SITE_H" /D "DEBUG" /D "_AFXDLL" /D "_UNICODE" /D "UNICODE" 
/Gm /EHsc /RTC1 /MDd /Yu"stdafx.h" /Fp"Debug GLW Ebner\ConnectionStringTest.pch" /Fo"Debug GLW Ebner\\" 
/Fd"Debug GLW Ebner\vc90.pdb" /W3 /nologo /c /ZI /TP /errorReport:prompt

The main program linker command line is:

/OUT:"../Debug GLW Ebner\ConnectionStringTest.exe" /INCREMENTAL /NOLOGO /LIBPATH:"../Debug GLW Ebner/Lib" 
/MANIFEST /MANIFESTFILE:"Debug GLW Ebner\ConnectionStringTest.exe.intermediate.manifest" 
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG 
/PDB:"q:\CAPS\trunk\Debug GLW Ebner\ConnectionStringTest.pdb" /SUBSYSTEM:CONSOLE /DYNAMICBASE /NXCOMPAT 
/MACHINE:X86 /ERRORREPORT:PROMPT CapsLib.lib DeploymentPlanLib.lib

P.S. A reviewer took the "visual-studio-debugging" tag out of this post and added the plain "debugging" tag. I do not agree with that action. This question is specific to debugging in the Visual Studio 2008 environment. Therefore, the visual-studio-debugging tag is more appropriate. I have added the debugging tag as suggested.


Solution

  • I compared the project settings of the library I'm trying to step into to the settings of a library I was able to step into. There were several differences. I changed my target library settings to match, and I was able to step into it.

    Here are the command lines that worked:

    Fixed library comiler command line:

    /Od /I "../CapsData" /I "../CapsLib" /I "../Include" /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "GREAT_LAKES_EBNER" 
    /D "SKIP_SITE_H" /D "DEPLOYMENT_PLANLIB" /D "DEBUG" /D "_WINDLL" /D "_AFXDLL" /D "_UNICODE" /D "UNICODE" 
    /Gm /EHsc /MDd /Fo"Debug GLW Ebner/" /Fd"Debug GLW Ebner/" /W3 /nologo /c /Zi /TP /errorReport:prompt
    

    Fixed library linker command line:

    /OUT:"../Debug GLW Ebner\DeploymentPlanLib.dll" /INCREMENTAL:NO /NOLOGO /LIBPATH:"../Debug GLW Ebner/Lib" 
    /DLL /MANIFEST /MANIFESTFILE:"Debug GLW Ebner\DeploymentPlanLib.dll.intermediate.manifest" 
    /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"q:\CAPS\trunk\Debug GLW Ebner\DeploymentPlanLib.pdb" 
    /SUBSYSTEM:WINDOWS /DYNAMICBASE:NO /IMPLIB:"../Debug GLW Ebner/Lib/DeploymentPlanLib.lib" 
    /MACHINE:X86 /ERRORREPORT:PROMPT CapsLib.lib CapsData.lib