C++ console application does not run/freezing problem


  • So I installed Visual Studio Express 2015 for Desktop on my system and decided to run it through a simple Hello World program to test it. When I create the program and only use one main source file with everything in it, the exe file runs normally. However, when I use a header file, despite compiling/linking with no errors when I run the file it immediately freezes and does not run. No console or anything. It freezes so bad that it won't even exit properly when you kill the process.

    This is what I have. testheader.h is contained in the same directory as the main source.

    #ifndef TESTHEADER_H
    #define TESTHEADER_H
    #include <iostream>
    using namespace std;

    #include "testheader.h"
    using namespace std;
    int main() {
    	cout << "Hello,world\n";
    	return 0;

    (Yes I'm aware I have two using namespace std statements, this still happens with one).

    I'm not a programmer by trade (more of a sometimes hobby) and as far as I know it could be an issue with options in Visual Studio. But that is why I'm presenting it here for ideas/fixes.

    • Edited by tervalas Saturday, November 21, 2015 2:52 PM
    Saturday, November 21, 2015 2:51 PM

All replies