VS2010/2008 C++ program error:output window disappears 运行窗口自动退出

本文详细介绍了在Visual Studio 2010和2008中运行C++程序时遇到的无法加载PDB文件的错误,并提供了解决方案,即在程序末尾加入system(pause)来防止窗口自动关闭。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在visul studio 2010和2008里面运行如下c++程序:

#include <iostream>
using namespace std;

int main()
{
 int a, b, c;
 int f(int x, int y, int z);
 cin>>a>>b>>c;
 c=f(a,b,c);
 cout<<c<<endl;
 return 0;
}

int f(int x, int y, int z)
{
 int m;
    if(x<y) m=x;
 else m=y;
 if(z<m) m=z;
 return m;
}

 

会出现如下内容且窗口自动退出:

'521.exe': Loaded 'D:\Program Files\521\Debug\521.exe', Symbols loaded.
'521.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'521.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'521.exe': Loaded 'C:\Windows\System32\KernelBase.dll', Cannot find or open the PDB file
'521.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'521.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
The program '[5960] 521.exe: Native' has exited with code 0 (0x0).

 

需要加 system(“pause”)

原因:system( "pause ")就是表示接收一个输入,比如显示的   按任意键继续... 

修改后程序为:

#include <iostream>
using namespace std;

int main()
{
 int a, b, c;
 int f(int x, int y, int z);
 cin>>a>>b>>c;
 c=f(a,b,c);
 cout<<c<<endl;
 system("pause");
 return 0;
 
}

int f(int x, int y, int z)
{
 int m;
    if(x<y) m=x;
 else m=y;
 if(z<m) m=z;
 return m;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值