Visual C ++ 2008问题

时间:2009-12-22 12:24:44

标签: c++ visual-studio-2008

好吧,这是愚蠢的,我有Microsoft Visual Studio 2008,工作正常,现在每当我运行.cpp程序时,我的命令提示窗口默认颜色为灰色,当我最初使用石灰绿色输出。 / p>

错误讯息:

'Testing.exe': Loaded 'C:\Users\codebox\Documents\Visual Studio 2008\Projects\Testing\Debug\Testing.exe', Symbols loaded.
'Testing.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll'
'Testing.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll'
'Testing.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll'
'Testing.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.30729.1_none_bb1f6aa1308c35eb\msvcp90d.dll'
'Testing.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.30729.1_none_bb1f6aa1308c35eb\msvcr90d.dll'
The program '[2644] Testing.exe: Native' has exited with code 0 (0x0).

为什么IDE加载Testing.exe,我  只是想测试.cpp?

下面的代码工作正常,但是,现在我收到上面的错误消息,我怀疑IDE:

// This program will assist the High Adventure Travel Agency
// in calculating the costs of their 4 major vacation packages.
#include <iostream>
#include <iomanip>
using namespace std;

// Constants for the charges.
const double CLIMB_RATE = 350.0;       // Base rate - Devil's Courthouse
const double SCUBA_RATE = 1000.0;      // Base rate - Bahamas
const double SKY_DIVE_RATE = 400.0;    // Base rate - Sky diving
// This program is a driver for testing the showFees function.
#include <iostream>
using namespace std;

// Prototype
void showFees(double, int);

int main()
{
   // Constants for membership rates
   const double ADULT = 40.0;
   const double SENIOR = 30.0;
   const double CHILD = 20.0;

   // Perform a test for adult membership.
   cout << "Testing an adult membership...\n"
        << "Calling the showFees function with arguments "
        << ADULT << " and 10.\n";
   showFees(ADULT, 10);

   // Perform a test for senior citizen membership.
   cout << "\nTesting a senior citizen membership...\n"
        << "Calling the showFees function with arguments "
        << SENIOR << " and 10.\n";
   showFees(SENIOR, 10);

   // Perform a test for child membership.
   cout << "\nTesting a child membership...\n"
        << "\nCalling the showFees function with arguments "
        << CHILD << " and 10.\n";
   showFees(CHILD, 10);
   return 0;
}

//*****************************************************************
// Definition of function showFees. The memberRate parameter      *
// the monthly membership rate and the months parameter holds the *
// number of months. The function displays the total charges.     *
//*****************************************************************

void showFees(double memberRate, int months)
{
    cout << "The total charges are $"
         << (memberRate * months) << endl;
}

一个人怎么想让他/她的代码开启呢? 或者我想要改变什么,我只想用C ++编写代码并测试我的代码,而不是那些该死的IDE。

  

解决方案:   Ctrl + 5

     

http://msdn.microsoft.com/en-us/library/ms235629.aspx

     

构建和检查程序

     

1

  On the Build menu, click Build Solution.

  The Output window displays information about the compilation
     

进展,例如,位置   构建日志和消息   陈述构建状态。      2。

  On the Debug menu, click Start without Debugging.

  If you used the sample program, a command window is displayed and
     

显示某些整数是否为   在集合中找到。

1 个答案:

答案 0 :(得分:4)

没有错误......您报告的消息只是VC ++,通知您哪些dll已加载,哪些调试符号可用等。最后一行告诉您程序以返回码0终止。如果您不知道看到你的程序正在运行它只是因为它非常快,最后控制台会自动关闭。

要查看程序的输出,您有很多选择:您可以在返回0上设置断点(因此程序在那里暂停,您可以在关闭之前查看控制台窗口),或者您可以在没有调试的情况下启动程序(在这种情况下VC ++会要求您在结束程序之前按一个键);你也可以添加行

cout<<"Press Enter to exit.";
cin.sync();
cin.ignore();

返回之前0:这样退出前的按键将被包含在应用程序中(不推荐这种方法,因为如果你想从已打开的控制台运行程序,你最终会有在应用程序结束时总是那令人讨厌的消息。)

顺便说一句,这个问题可能会记录关于VC ++和许多其他IDE的“最常见问题”:)

  

为什么IDE加载Testing.exe,我只想测试.cpp?

你知道......要运行.cpp,你必须先编译它......你从编译中获得了什么?一个.exe ...&gt; _&gt;

  

我只是想用C ++编写代码并测试我的代码,而不是讨厌该死的IDE。

当你必须调试一个大型应用程序时,你将祝福那个“该死的IDE”。