C++ “无法启动程序”(调试版本)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/612624/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"Unable to start program" (Debug build)
提问by heeen
Microsoft Visual Studio
Unable to start program 'theprogram.exe'.
This application has failed to start because the application configuration is incorrect. Review the manifest file for possible errors. Reinstalling the application may fix this problem. For more details, please see the application event log.
OK
微软视觉工作室
无法启动程序“theprogram.exe”。
此应用程序无法启动,因为应用程序配置不正确。查看清单文件以查找可能的错误。重新安装应用程序可能会解决此问题。有关更多详细信息,请参阅应用程序事件日志。
好的
The program in question is a C++ project, no MFC, no AFX, used libraries are:
opengl32.lib glu32.lib SDL.lib sdlmain.lib
plus the pre-built libboost_signals-vc80-mt-gd-1_37.lib
from BoostPro computing.
有问题的程序是一个 C++ 项目,没有 MFC,没有 AFX,使用的库是:
opengl32.lib glu32.lib SDL.lib sdlmain.lib
加上libboost_signals-vc80-mt-gd-1_37.lib
从 BoostPro 计算预先构建的。
The program starts fine in Release builds, but on Debug I get the aforementioned error message, plus a zombie process attached to the debugger that I can't kill.
该程序在发布版本中启动良好,但在调试时我收到上述错误消息,以及附加到调试器的僵尸进程,我无法杀死它。
The manifest files for debug build:
用于调试构建的清单文件:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.DebugCRT" version="8.0.50608.0" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50608.0" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.DebugCRT" version="8.0.50727.762" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.762" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
</dependentAssembly>
</dependency>
</assembly>
and Release build:
和发布版本:
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
</assembly>
Dependency walker:
依赖行走器:
Error: The Side-by-Side configuration information for "c:\prog\opengl guis\gg-0.7.0\debug\TUTORIAL.EXE" contains errors. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem (14001).
Error: At least one required implicit or forwarded dependency was not found.
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with different CPU types were found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
DLLs:
DLL:
DEVIL.DLL
ILU.DLL
MSVCP80D.DLL
MSVCR80D.DLL
SDL.DLL
DWMAPI.DLL
ADVAPI32.DLL
DCIMAN32.DLL
DDRAW.DLL
GDI32.DLL
GLU32.DLL
KERNEL32.DLL
MSVCRT.DLL
NTDLL.DLL
OPENGL32.DLL
RPCRT4.DLL
SECU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DLL
UXTHEME.DLL
VERSION.DLL
W32TOPL.DLL
WINHTTP.DLL
WININET.DLL
WINIPSEC.DLL
WINMM.DLL
WINSCARD.DLL
WINSPOOL.DRV
WINSTA.DLL
WINTRUST.DLL
WLDAP32.DLL
WMI.DLL
WS2_32.DLL
WS2HELP.DLL
WSOCK32.DLL
WTSAPI32.DLL
WZCDLG.DLL
WZCSAPI.DLL
WZCSVC.DLL
MSVCR80.DLL
TUTORIAL.EXE
linker call:
链接器调用:
/OUT:"C:\prog\OpenGL GUIS\GG-0.7.0\Debug\tutorial.exe" /INCREMENTAL /NOLOGO /LIBPATH:"C:\prog\SDL-1.2.13\lib" /LIBPATH:"C:\prog\contrib\lib_win32" /LIBPATH:"C:\prog\boost\boost_1_37\lib" /MANIFEST /MANIFESTFILE:"Debug\tutorial.exe.intermediate.manifest" /NODEFAULTLIB:"LIBC.LIB" /DEBUG /PDB:"c:\prog\OpenGL GUIS\GG-0.7.0\Debug\tutorial.pdb" /SUBSYSTEM:CONSOLE /MACHINE:X86 /ERRORREPORT:PROMPT opengl32.lib glu32.lib SDL.lib sdlmain.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ".\debug\gg.lib"
采纳答案by Rowland Shaw
Looks like the debug build is linked against both debug and release runtimes which would be a very bad thing -- you haven't included either in the list of libraries you're linking against -- might be worth checking though
看起来调试版本与调试和发布运行时都链接了,这将是一件非常糟糕的事情——你没有包含在你链接的库列表中——不过可能值得检查
Edit:
Might also be worth checking for any #pragma comment (lib...)
statements which can force the linker to include an additional library, causing potential conflicts (see also documentation on MSDN)
编辑:可能也值得检查任何#pragma comment (lib...)
可以强制链接器包含附加库的语句,从而导致潜在的冲突(另请参阅MSDN 上的文档)
回答by Lainey
If you right click on the solution and go to Properties, you need to select Single Startup Project and select your hosting project. This worked for me.
如果右键单击解决方案并转到“属性”,则需要选择“单一启动项目”并选择您的托管项目。这对我有用。
回答by crashmstr
You've also got twodifferent sets of versions listed in the manifest for the debug build!
您还在调试版本的清单中列出了两组不同的版本!
It might be a bit different since you are on VS2005, but you might find something helpful in my question: App does not run with VS 2008 SP1 DLLs, previous version works with RTM versions
由于您使用的是 VS2005,因此可能会有所不同,但您可能会在我的问题中找到一些有用的信息:应用程序不与 VS 2008 SP1 DLL 一起运行,以前的版本适用于 RTM 版本
回答by Diederik
I had a very similar problem with Visual Studio 2005 C++ express. Installing the platform SDK, put the MSVCR80D dll in the right place, but VS didn't seem to find it.
我在 Visual Studio 2005 C++ express 中遇到了非常相似的问题。安装平台SDK,把MSVCR80D dll放在正确的地方,但是VS好像没有找到。
Installing SP1 for VS Express, and a restart, solved the problem for me.
为 VS Express 安装 SP1 并重新启动,为我解决了这个问题。
Get it here
在这里获取
回答by Vladimir Prus
This sounds similar to the problem discussed in this Boost.Build thread. The possible solutions involve making sure you have selected to install all flavours of runtime, when installing Visual Studio, and using the sxstrace.exe tool to give more detailed diagnostic. However, in that cases nothing worked until Visual Studio was reinstalled from scratch.
这听起来类似于这个Boost.Build thread 中讨论的问题。可能的解决方案包括确保您在安装 Visual Studio 时选择安装所有版本的运行时,并使用 sxstrace.exe 工具提供更详细的诊断。但是,在这种情况下,直到从头重新安装 Visual Studio 后才起作用。
回答by Dani van der Meer
Try to look in the application log like the error messages suggests. I would also try and use a tool like Dependency walkerto find a possible missing/wrong DLL problem.
尝试按照错误消息提示的方式查看应用程序日志。我还会尝试使用像Dependency walker这样的工具来查找可能的 DLL 丢失/错误问题。
回答by xian
This happens to me all the time! Here is a little trick I discovered to fix it:
这种情况一直发生在我身上!这是我发现的修复它的一个小技巧:
- Go to 'Build > Clean Solution'
- In the 'Solution Explorer' right click your project, and go to properties
- Make sure the configuration at the top left is 'Debug'
- Go to 'Linker > System > SubSystem' and change that to 'Not Set.' (If it's already set to 'Not Set' change it to 'Console.')
- Rebuild your program, if it fails to compile that's fine.
- Go back to 'Linker > System > SubSystem' and change it to what it previously was, and recompile.
- 转到“构建>清洁解决方案”
- 在“解决方案资源管理器”中右键单击您的项目,然后转到属性
- 确保左上角的配置是“调试”
- 转到“链接器>系统>子系统”并将其更改为“未设置”。(如果已设置为“未设置”,请将其更改为“控制台”。)
- 重新构建你的程序,如果它编译失败也没关系。
- 返回“链接器>系统>子系统”并将其更改为以前的状态,然后重新编译。
Now, as to why this works, I'm not sure.
现在,至于为什么会这样,我不确定。
回答by AlfredD
Had the same problem running an application that was compiled in Debug configuration. I was linking with an external library which had been linked with the Release version of the run-time library so I ended up with both Release and Debug run-times in the same process. Since I didn't have the Debug version of this external library I had to stick to Release build, cumbersome to debug but workable nonetheless.
运行在调试配置中编译的应用程序时遇到了同样的问题。我正在链接一个外部库,该库已与运行时库的 Release 版本链接,因此我最终在同一进程中同时使用 Release 和 Debug 运行时。由于我没有这个外部库的 Debug 版本,我不得不坚持使用 Release 版本,调试起来很麻烦,但仍然可行。
回答by vsprogrammer
It looks like the same issue as described in this article: http://tmoniuszko.blogspot.com/2011/11/installing-service-pack-1-for-visual.html
它看起来与本文中描述的问题相同:http: //tmoniuszko.blogspot.com/2011/11/installing-service-pack-1-for-visual.html
回答by user5303727
Follow these steps:
按着这些次序:
- Save the project in new folder.
- File; Move the source.cpp into the project.
- Build.
- Run.
- 将项目保存在新文件夹中。
- 文件; 将 source.cpp 移动到项目中。
- 建造。
- 跑。