c++g++

G++ Compiles, but nothing happens


I am currently running g++ version 4.3.4 and when I run the following command:

g++ -g -Wall test.cpp -o test.exe

on this:

#include<stdlib.h>
#include<iostream>

using namespace std;

int main (){
   cout << "Hello World!";
   system("pause");
   return 0;
}

Nothing seems to happen: Cygwin seems to lag for a moment, but no exe is created (if there are errors in the cpp source, they are displayed)

And ideas?


Solution

  • I suspect you're actually invoking the built in test command. Are you executing your program as ./test or ./test.exe? This should work, but I'd rename it, just in case.