Hope A
Hope A

Reputation: 27

Can not run my first Win32 application in visual c++ 2010

I have the following first code in Visual C++:

#include <iostream>
using namespace std;

int main()
{
    cout<<"Hello World" << endl;
    system("PAUS");
    return (0);
}

I created a Win32 console application project. I deleted the available header files and my project area looks like: ![enter image description here][1]

When I right click my cpp file and click compile, I get the folowing:

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

But, when I click Build, the cmd black screen appears so fast then disappears and I get the following errors:

'test2.exe': Loaded 'C:\Users\user\Documents\Visual Studio 2008\Projects\test2\Debug\test2.exe', Symbols loaded.
'test2.exe': Loaded 'C:\Windows\System32\ntdll.dll'
'test2.exe': Loaded 'C:\Windows\System32\kernel32.dll'
'test2.exe': Loaded 'C:\Windows\System32\KernelBase.dll'
'test2.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.21022.8_none_96748342450f6aa2\msvcr90d.dll'
The program '[6056] test2.exe: Native' has exited with code 0 (0x0).

Can you help me ?

Upvotes: 0

Views: 478

Answers (2)

Cheers and hth. - Alf
Cheers and hth. - Alf

Reputation: 145194

In Visual Studio press [Ctrl F5] to run the program without debugging.

Then it stops at the end.

To run with debugging, press only [F5]. Then you might find it convenient to set a breakpoint on the last right brace of main, since with debugging the program doesn't stop automatically. That is, it's run on its own, not via a batch file.

Upvotes: 2

Aniket Inge
Aniket Inge

Reputation: 25695

its system("PAUSE"); not system("PAUS"); Other than that, I see no reason why your program shouldn't compile on a correctly setup development environment.

Upvotes: 0

Related Questions