为什么我无法进入 C++ 项目中的库源代码?

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

我有一个使用 DLL 的 C++ 小程序。程序和DLL在同一个解决方案中,都是使用Visual Studio 2008编写的。我无法进入库的源代码。我在两个项目中都设置了用于调试的链接器。

库编译命令行为:

/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

库链接器命令行是:

/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

主程序编译命令行为:

/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

主程序链接器命令行为:

/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。审阅者从此 post 中取出了“visual-studio-debugging”标签,并添加了普通的“debugging”标签。我不同意那个动作。这个问题是针对在Visual Studio 2008环境下调试的。因此,visual-studio-debugging 标签更为合适。我已经按照建议添加了调试标签。

我将我尝试进入的库的项目设置与我能够进入的库的设置进行了比较。有几个不同之处。我更改了我的目标库设置以匹配,并且我能够进入它。

以下是有效的命令行:

修复了库编译器命令行:

/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

修复了库链接器命令行:

/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