I want a code that open a text file and able to write few text on it. Here is the code I have written.

Code:
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
	ofstream file;
	file.open ("example.txt");

	if(file.is_open())
		{
			file << "Write a text line";
            		file.close();
		}
	else
		{
			file << "Unable to wirte text";
		}
	return 0;
}
When I compiled it, gives the following error.

Compiling...
rbf.cpp
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup
Debug/ReadFile.exe : fatal error LNK1120: 1 unresolved externals
What's wrong there. Can you guys help me.