views:

119

answers:

1

Okay, this is getting stupid, I have Microsoft Visual Studio 2008, was working fine, now whenever I run a .cpp program my command prompt windows has a default color of gray when I initially had lime green for the output.

Error Message:

'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).

Why is the IDE loading Testing.exe, I just want to test a .cpp?

Code below works fine, except,now i get the above error message, I suspect the 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;
}

How is a guy suppose to get his/her code on, with this happening? Or what am I suppose to change, I just want to code in C++ and test my code that's all, not mess around with the damn IDE.

Solution: Ctrl+5

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

To build and examine the program

1.

  On the Build menu, click Build Solution.

  The Output window displays information about the compilation

progress, for example, the location of the build log and a message that states the build status. 2.

  On the Debug menu, click Start without Debugging.

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

shows whether certain integers are found in the set.

+4  A: 

There's no error... the messages you reported are just VC++ notifying you about which dlls are loaded, which debug symbols are available, etc. The last line tells you that the program terminated with return code 0. If you don't see your program running it's just because it's very fast, and at its end the console automatically closes.

To see the output of your program you have many options: you may set a breakpoint on the return 0 (so the program is paused there, and you can have a look at the console window before it closes), or you may start the program without debugging (in that case VC++ asks you to press a key before ending the program); you could also add the lines

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

before the return 0: in this way the key press before exit will be included in the application (I don't recommend this approach, though, because if you want to run the program from an already opened console you end up having always that annoying message at the end of the application).

By the way, this question may hold the record of "most asked question" about VC++ and many other IDEs :)

Why is the IDE loading Testing.exe, I just want to test a .cpp?

You know... to run a .cpp you must compile it first... and what do you get from a compilation? A .exe... >_>

I just want to code in C++ and test my code that's all, not mess around with the damn IDE.

When you'll have to debug a big application you'll bless that "damn IDE".

Matteo Italia
The IDE's are nice if you are a professional, I am not, I am a newb, just having fun, and I am not developing applications for NASA, that's probably one reason for hating the IDE, in addition to the fact that they all have learning curves that detract from coding.
Newb
@Newb Nobody is forcing you to use the IDE. You can use freely available C++ compilers which are not associated to an IDE.
Daniel Daranas
Daniel Daranas, please list some, so I can get on with the code...
Newb
I don't think it's so difficult... create a new empty win32 project, add your file, add a breakpoint in the end, press F5. End of the story.Moreover, for simple tasks (managing files in the project, adding breakpoint, adding watches, etc) they are almost all the same, learned one you learned them all. And trust me, even in simple programs being able to watch the variables on the fly is very useful.
Matteo Italia
@Newb: See this list http://en.wikipedia.org/wiki/List_of_compilers#C.2FC.2B.2B_compilers and order it by the rightmost column.
Daniel Daranas
And, by the way, you can use the Visual C++ compiler directly from the command line: Start->Programs->Visual Studio (etc)->Tools->Visual Studio Prompt or something like that; the compiler name is cl, use cl /? to get the command line options.
Matteo Italia
Maybe I should be doing this: g++ -o HelloWorld.cpp and leave Windows alone.
Newb
@Newb Evaluate the different options you have and choose the one which best suits you.
Daniel Daranas
Yeah, you are right Daniel Daranas, I guess I will figure out how to get this devil working (Visual C++ IDE), this is part of problem solving in essence or at least for me, sooner or later I will have to learn the IDE anyhow, thanks, it's 5:02AM let's me get this problem resolved, if it was working before, it should work after.
Newb
Thanks for all the help guys.
Newb
You can use whatever compiler you want, to learn C++ the only required thing is that conforms to the standard; the syntax of the command line version of the compiler may change a bit, but what you should really care now are just the most basic options, so once you've learnt that on g++ it's -o and on VC++ is /Fe you're done.By the way, one of the advantages of the IDE is that it takes care of all the complexities of the command line version of the compiler and of the debugger, so all you have to do is press F5 to compile, run and debug your application.
Matteo Italia
cout<<"Press Enter to exit.";cin.sync();cin.ignore();This is pretty cool and neat, just having some fun with it.
Newb
Matteo Italia, so the IDE takes the .cpp converts it by compiling it to a .exe which is then output to the console or command prompt or at least that's what I am seeing from my command prompt.
Newb
Yes, it goes almost like that; actually the compiler invokes the compiler and the linker in two separate steps, but in this case it's not important.
Matteo Italia