Click here to Skip to main content
15,888,133 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
here is simple code

XML
#include "stdafx.h"
#include <iostream>

int main()
{
  std::cout << "Hello World!";
}



run it but get some output and blank windows
whats wrong about my visual studio ?
how fix it?


'hello world.exe' (Win32): Loaded 'C:\Users\user\Documents\Visual Studio 2012\Projects\hello world\Debug\hello world.exe'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr110d.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp110d.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Program Files\WIDCOMM\Bluetooth Software\syswow64\BtMmHook.dll'. Cannot find or open the PDB file.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Cannot find or open the PDB file.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\psapi.dll'. Symbols loaded.
'hello world.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Symbols loaded.
'hello world.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ole32.dll'
The program '[6908] hello world.exe' has exited with code 0 (0x0).
Posted

Well, the first thing would be to see if you actually get the code to do anything. Since your existing code runs in a console, outputs a string and exits, it may not show anything because the console window closes on exit... :laugh:

Try putting a breakpoint on the std::cout line, and run your program again - does it stop at the breakpoint? If so, single step and see if you can read the "Hello world!"
 
Share this answer
 
As Griff noted, you need to download nothing.
See, for instance: "C++ Console applications exit immediately when run"[^].
 
Share this answer
 
Try adding the extra lines as below:
C++
#include "stdafx.h"
#include <iostream>
 
int main()
{
    std::cout << "Hello World!" << endl;
    std::cout << "Press enter to continue: ";
    std::cin.get();

    return 0;
}

Also, make sure you are creating the Debug version.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900