Link Error--Please Help me !! (SOS)
-
I have a Code which compiles well; But when I build the Exe file It gives me the following Link Errors: *********************************************************************** Linking... LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 Debug/testbug.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. testbug.exe - 2 error(s), 0 warning(s) I have NO CLUE What is going wrong and How to Fix it................Please Help me !! The Code of the program is as follows: **********************************************************88 #include #include #include #include #include #include // get the STL stuff #include #include // this turns off a useless compiler warning #pragma warning(disable:4786) // a namespace is a C++ way of hiding class names.it helps prevent name collisions in large // projects. "using namespace std" says that you want to use classes that are in the "std" namespace. using namespace std ; // same thing here... using namespace std::rel_ops ; int main() { ifstream infile("in_file"); if(!infile) {cerr<<"Error, unable to open inputfile"; return -1; } else { cout<<"Congrats !!"; return 0;} };
-
I have a Code which compiles well; But when I build the Exe file It gives me the following Link Errors: *********************************************************************** Linking... LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 Debug/testbug.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. testbug.exe - 2 error(s), 0 warning(s) I have NO CLUE What is going wrong and How to Fix it................Please Help me !! The Code of the program is as follows: **********************************************************88 #include #include #include #include #include #include // get the STL stuff #include #include // this turns off a useless compiler warning #pragma warning(disable:4786) // a namespace is a C++ way of hiding class names.it helps prevent name collisions in large // projects. "using namespace std" says that you want to use classes that are in the "std" namespace. using namespace std ; // same thing here... using namespace std::rel_ops ; int main() { ifstream infile("in_file"); if(!infile) {cerr<<"Error, unable to open inputfile"; return -1; } else { cout<<"Congrats !!"; return 0;} };
See knowledge base articles Q125750 and Q131204 to help you with this problem. Grtx, Berry
-
I have a Code which compiles well; But when I build the Exe file It gives me the following Link Errors: *********************************************************************** Linking... LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 Debug/testbug.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. testbug.exe - 2 error(s), 0 warning(s) I have NO CLUE What is going wrong and How to Fix it................Please Help me !! The Code of the program is as follows: **********************************************************88 #include #include #include #include #include #include // get the STL stuff #include #include // this turns off a useless compiler warning #pragma warning(disable:4786) // a namespace is a C++ way of hiding class names.it helps prevent name collisions in large // projects. "using namespace std" says that you want to use classes that are in the "std" namespace. using namespace std ; // same thing here... using namespace std::rel_ops ; int main() { ifstream infile("in_file"); if(!infile) {cerr<<"Error, unable to open inputfile"; return -1; } else { cout<<"Congrats !!"; return 0;} };
Apparently your project settings are not in alignment with what you want to do. When you created your project, you did not select "Win32 console application". Since your program contains a main() function and does nothing windows-specific (that is, displaying windows and stuff), your application is a console application. Your project settings seem to be "Win32 application" or similar. In such projects, the main entry point is a function named WinMain() and *not* main(). Good luck anyway