#include
#include
using namespace std;
namespace my_namespace
{
/*
* @!brief Write to a file:
*/
void create_main_file()
{
ofstream out("mymain.c");
if(!out) {
cout << "Cannot open file.\n";
//return 1;
}
out << "This is a text file.";
out.close();
}
/*
* @!brief main function.
*/
int main()
{
create_main_file();
return 0;
}
}///my_namespace
--> While I was compiling above piece of code... I got following errors:
>> unresolved external symbol _main referenced in function _mainCRTStartup
I followed the literature on the net but solution were tangent to what I was expecting.
Then finally I started commenting out the code portions going from basic..
Solution: I was having main in my own namespace... "main" function should always be outside any local namespace.