I have the next files in c++ in Visual Studio 2010:
stdafx.h
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
void printHello();
// TODO: reference additional headers your program requires here
inter.cpp
// Inter.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
printHello();
}
stdafx.cpp
// stdafx.cpp : source file that includes just the standard includes
// Inter.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
#include <iostream>
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
void printHello() {
std::cout << "Hello World!" << std::endl;
}
and I got it:
'Inter.exe': Loaded 'C:\Users\Adamsh\Documents\Visual Studio 2010\Projects\Inter\Debug\Inter.exe', Symbols loaded.
'Inter.exe': Loaded 'C:\Windows\System32\ntdll.dll', Cannot find or open the PDB file
'Inter.exe': Loaded 'C:\Windows\System32\kernel32.dll', Cannot find or open the PDB file
'Inter.exe': Loaded 'C:\Windows\System32\msvcp100d.dll', Symbols loaded.
'Inter.exe': Loaded 'C:\Windows\System32\msvcr100d.dll', Symbols loaded.
The program '[3636] Inter.exe: Native' has exited with code 0 (0x0).
How can I fix it?
AFAICS there’s nothing technically wrong with your program as a Visual C++ specific program.
However, it is needlessly compiler specific.
In particular, replace your Visual C++ specific and hopelessly meaningless monstrosity
with a standard C++
For debugging your program, in Visual Studio choose a “Debug” build instead of “Release”.
EDIT: Folks in the Lounge commented about maybe the program is finishing too fast for the OP? If so, just place a breakpoint on the closing brace of
main.