Hi all,
I have just start to work on C++.
I want to open a text file, then write few text there. This is the code I wrote for that.
#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 compile 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 to solve it.