VS2010中MFC模板项目的困难
我正在使用 Visual Studio 2010 来试验 MFC。
我按照向导创建了一个模板 MFC 项目。我选择了基于对话框的应用程序,并取消选中 ActiveX 控件等其他选项。
未更改任何代码后,我按 F5,应用程序运行。
然后,使用表单设计器,将丰富的编辑控件从工具箱拖到应用程序上。我再次按 F5,应用程序编译但立即退出并显示错误代码 0。
为什么会发生这种情况?我做错了什么?
这是包含 RichEdit 时的输出:
'odpmfc2.exe': Loaded 'C:\Visual Studio 2010\Projects\odpmfc2\Debug\odpmfc2.exe', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100ud.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\lpk.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\usp10.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shlwapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16385_none_ebf82fc36c758ad5\comctl32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msimg32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\apphelp.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\AppPatch\AcLayers.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sspicli.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shell32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\userenv.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\profapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\winspool.drv', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mpr.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\uxtheme.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100enu.dll', Binary was not built with debug information.
The program '[7420] odpmfc2.exe: Native' has exited with code 0 (0x0).
所有这些加载错误都发生有点可疑。但如果出现问题,为什么会以错误代码 0 退出呢?
这是成功运行的输出。加载失败仍然发生:
'odpmfc2.exe': Loaded 'C:\Visual Studio 2010\Projects\odpmfc2\Debug\odpmfc2.exe', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100ud.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\lpk.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\usp10.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shlwapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16385_none_ebf82fc36c758ad5\comctl32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msimg32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\apphelp.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\AppPatch\AcLayers.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sspicli.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shell32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\userenv.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\profapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\winspool.drv', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mpr.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\uxtheme.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100enu.dll', Binary was not built with debug information.
'odpmfc2.exe': Loaded 'C:\Windows\System32\cryptbase.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\clbcatq.dll', Cannot find or open the PDB file
The program '[7956] odpmfc2.exe: Native' has exited with code 0 (0x0).
更新我删除了RichEdit,并添加了这些其他控件,并且工作正常:
- MFC VSListBox控件
- 列表控件
- MFC链接控件
- 网络地址控件
切线:为什么 RichEdit2 是表单生成器中唯一可用的 RichEdit? (我在 Windows 7 上使用 VS 2010)
I'm using Visual Studio 2010 to experiment with MFC.
I have created a template MFC project by following the wizard. I chose a dialog based app, and unchecked other options like ActiveX controls.
After making no code changes, I hit F5, and the app runs.
Then, using the form designer, I drag a rich edit control from the toolbox onto the app. I hit F5 again, and the app compiles but exits with error code 0 instantly.
Why could this be happening? What am I doing wrong?
This is the output when the RichEdit is included:
'odpmfc2.exe': Loaded 'C:\Visual Studio 2010\Projects\odpmfc2\Debug\odpmfc2.exe', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100ud.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\lpk.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\usp10.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shlwapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16385_none_ebf82fc36c758ad5\comctl32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msimg32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\apphelp.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\AppPatch\AcLayers.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sspicli.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shell32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\userenv.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\profapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\winspool.drv', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mpr.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\uxtheme.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100enu.dll', Binary was not built with debug information.
The program '[7420] odpmfc2.exe: Native' has exited with code 0 (0x0).
It is a bit suspicious that all these load errors are occurring. But if something is going wrong, why is it exiting with error code 0?
Here is the output from a successful run. The load failures still occur:
'odpmfc2.exe': Loaded 'C:\Visual Studio 2010\Projects\odpmfc2\Debug\odpmfc2.exe', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100ud.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
'odpmfc2.exe': Loaded 'C:\Windows\System32\user32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\gdi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\lpk.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\usp10.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msvcrt.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shlwapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7600.16385_none_ebf82fc36c758ad5\comctl32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\advapi32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sechost.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\rpcrt4.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msimg32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\oleaut32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\ole32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\apphelp.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\AppPatch\AcLayers.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\sspicli.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\shell32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\userenv.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\profapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\winspool.drv', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mpr.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\imm32.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\msctf.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\uxtheme.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\dwmapi.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\mfc100enu.dll', Binary was not built with debug information.
'odpmfc2.exe': Loaded 'C:\Windows\System32\cryptbase.dll', Cannot find or open the PDB file
'odpmfc2.exe': Loaded 'C:\Windows\System32\clbcatq.dll', Cannot find or open the PDB file
The program '[7956] odpmfc2.exe: Native' has exited with code 0 (0x0).
UPDATE I removed the RichEdit, and added these other controls, and it works fine:
- MFC VSListBox Control
- List Control
- MFC Link Control
- Network Address Control
Tangent: Why is RichEdit2 the only RichEdit available in the form builder? (I'm using VS 2010 on Windows 7)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案:我需要添加此调用:
如 MSDN:
Solution: I needed to add this call:
As noted on MSDN: