Results 1 to 3 of 3

Thread: ??? Some error when making classes ???

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    Code:
    LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    Debug/Random.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.
    heres my code:

    Code:
    #include <iostream.h>
    
    class AGE  {
        public:
               void showage();
               void setage(int eAge);
        protected:
               int age;
    };
    
        void AGE::showage()  {
            cout<<age;
        }
        void AGE::setage(int eAge)  {
            age=eAge;
    	}
    
    int main()
    {
    	AGE steve;
        int iage;
        cin>>iage;
        steve.setage(iage);
        steve.showage();
    
        int dummy;
        cin>>dummy;
        return 0;
    }
    I'm stumped.

  2. #2
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Notice the error mentions "unresolved external WinMain"? It's looking for a function called WinMain() but it can't find one. Why would it do that? Because your project is a Win32 application, not a Win32 console application, that's why. Similarly, if you get "unresolved external _main" or something like that, it's usually because your project is a console app and you're writing Windows code (Windows apps start at WinMain(), not main() ).
    Harry.

    "From one thing, know ten thousand things."

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    sorry must have pushed the wrong button

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width