error: ‘::main’ must return ‘int’
<p>I am currently using Putty virtual machine (UNIX) for my class, and we are doing a short C++ assignment. The assignment is to:
"Create a C++ program that tests to see if the file accounts exists and prints a message to say whether the file exists"</p>

<p>This is what I have, but when I try to compile the code, I get this error:
error: ‘::main’ must return ‘int’</p>

<pre><code>#include&lt;iostream&gt;
#include&lt;fstream&gt;

using namespace std;
inline bool exists_test1 (const std::string&amp; name) {

if (FILE *file = fopen(name.c_str(), "r")) {
fclose(file);
return true;
} else {
return false;
}
}

void main()
{
string s;
cout&lt;&lt;"Enter filename";
cin&gt;&gt;s;
bool ans =exists_test1(s);
if(ans)
{
cout&lt;&lt;"File Exist"&lt;&lt;endl;
}
else
{
cout&lt;&lt;"File Does not Exist";
}
}
</code></pre>