Simple file write function in C++
<p>I have this code:</p>

<pre><code>// basic file operations
#include &lt;iostream&gt;
#include &lt;fstream&gt;
using namespace std;

int main()
{
    writeFile();
}

int writeFile () 
{
  ofstream myfile;
  myfile.open ("example.txt");
  myfile &lt;&lt; "Writing this to a file.\n";
  myfile &lt;&lt; "Writing this to a file.\n";
  myfile &lt;&lt; "Writing this to a file.\n";
  myfile &lt;&lt; "Writing this to a file.\n";
  myfile.close();
  return 0;
}
</code></pre>

<p>Why is this not working? it gives me the error:</p>

<pre class="lang-none prettyprint-override"><code>1&gt;------ Build started: Project: FileRead, Configuration: Debug Win32 ------
1&gt;  file.cpp
1&gt;e:\documents and settings\row\my documents\visual studio 2010\projects\fileread\fileread\file.cpp(8): error C3861: 'writeFile': identifier not found
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
</code></pre>

<p>and this is just a simple function. I'm using Visual Studio 2010.</p>
