|
-
Sep 4th, 2007, 06:28 AM
#1
Thread Starter
PowerPoster
[RESOLVED] Linking error
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.
“victory breeds hatred, the defeated live in pain; happily the peaceful live giving up victory and defeat” - Gautama Buddha
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|