Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ LINK : error LNK2001: unresolved external symbol _main

LINK : error LNK2001: unresolved external symbol _main

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Fender   (10 posts)  Bio
Date Sun 02 Nov 2003 04:38 PM (UTC)

Amended on Sun 02 Nov 2003 04:44 PM (UTC) by Fender

Message
I get that error:

LINK : error LNK2001: unresolved external symbol _main

after all of the hours and hours of going through everything and making it so that it will all compile in MSVC++ 6.0

and this is the last one I will have, and its the only one i cant seem to get past.

can somebody help me out with this?

On msdn.com it says that error means that it cant find main(), but its in webserver.c......why doesnt it find it?

It is also found in numerous other files such as services.c, webclient.c,
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Sun 02 Nov 2003 07:36 PM (UTC)
Message
You can't have more than one main. If you truly do have multiple mains declared, then that's most likely what's confusing the compiler.

Check the macroes and #ifdefs to make sure that the mains aren't being "deactivated" or anything... if I remember correctly, there is quite different behavior for the Unix main and the Windows main. Maybe even the Windows version implements WinMain, which is the entry point for Win32 applications (as opposed to console applications.)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Fender   (10 posts)  Bio
Date Reply #2 on Sun 02 Nov 2003 07:52 PM (UTC)
Message
well i found main function in service.c, but for some reason the linker doesnt want to find it


and yes msvc++ supports winmain, but smaug doesnt.

any other ideas on what i should do?
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #3 on Mon 03 Nov 2003 03:59 AM (UTC)
Message
You said that you found multiple mains... you need to look at whether or not they're being seen by the compiler - e.g., the preprocessor definitions like #ifdef WIN32 - and then determine how to fix it if they're not - or if multiple ones are being seen.

What do you mean, SMAUG doesn't support WinMain? SMAUG doesn't care about that. That's just the entry point function for your application, and the compiler cares... not SMAUG. Of course, if SMAUG assumes that all your initialization is in main, not WinMain, then yes, you have to call that code somehow, but that's a compiler issue, not a SMAUG issue.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Samson   USA  (683 posts)  Bio
Date Reply #4 on Mon 03 Nov 2003 11:26 AM (UTC)
Message
webserver.c and webclient.c are probably part of the IMC2 code that was originally packaged with Smaug. You should be able to safely remove those as they are ancient and probably of little value.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #5 on Tue 04 Nov 2003 03:59 AM (UTC)
Message
service.c may not be in your project.

It doesn't help to have main in your file if it isn't in the project.

And yes, main is the entry point for a console app.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,555 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.