C++ for dummies: how to compile a code.

Hi.
I wrote a small programm which shows me display's refresh rate

#include "stdafx.h"
#include "windows.h"
#include "iostream"
using namespace std;
int _tmain(int cout)
{
HDC hDCScreen = GetDC(NULL);
int RefreshFrequency = GetDeviceCaps(hDCScreen, VREFRESH);
ReleaseDC(NULL, hDCScreen);
std::cout<<RefreshFrequency;
}

I compiled it in VS 2010 (winXP) and it works fine. How to compile the similar code under Linux/freeBSD? What headers should i include?

Hint: If your code has #include "windows.h" in it, odds are good it's never going to work in linux. stdafx and _tmain are also Microsoft-isms. This is not plain C -- you are using the Windows API, which requires Windows.

If you wanted something similar in Linux, I would try using the Simple Directmedia Layer at libsdl.org, many Linux multimedia things use it, and it has a Windows port too.