Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Link Error--Please Help me !! (SOS)

Link Error--Please Help me !! (SOS)

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++debuggingtutorialquestion
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    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;} };

    B L 2 Replies Last reply
    0
    • L Lost User

      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;} };

      B Offline
      B Offline
      Berry van Olphen
      wrote on last edited by
      #2

      See knowledge base articles Q125750 and Q131204 to help you with this problem. Grtx, Berry

      1 Reply Last reply
      0
      • L Lost User

        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;} };

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups