Well, first of all I think that this is C (and no C++) code:
Code:
#include <stdio.h>
int main() {
printf("hello world");
return 0;
}
so It should be compiled with
Code:
gcc program_name.c -o progam_name
It's true that the code is also C++ code, but if you want it to be compiled as C++ code, then it will not work. You will need this kind of modifications (IIRC):
Code:
#include <cstdio>
int main() {
printf("hello world");
return 0;
}
or
Code:
#include <iostream>
using namespace std;
int main() {
cout << "hello world" << endl;
return 0;
}
and compile it with:
Code:
g++ program_name.cpp -o progam_name
In any case, the result is a file called "program_name" that you can run: by clicking on it or by executing it from the CLI. In that case you'll likely need to add "./" before the name of the file.
About non console programs, the same history applies. You have to compile them under Linux with a proper compiler, but since Windows GUI programs are based on the Windows API, which is not the same that Linux, they won't work anyway. If you want to write GUI programs for Linux, you'll need to learn one of the --many-- libraries available to do that. Some of them have been ported to Windows, in the case you are interested to develop for both platforms.
HTH!