Solved

LNK2001: undefined external "_main"

Posted on 1997-05-21
2
262 Views
Last Modified: 2012-06-27
Whenever I try to build the example WSOCK from the MS VC++ v4.2 samples\SDK\WIN32 folder, it will not link, claiming that "_main()" is undefined.  I have followed the instructions for building a multithreaded application in the help file, which involves including the LIBCMT.LIB library, which would appear to cause this problem.  As a windows program, there is no main() function, just a WinMain() function.
How do I avoid/get around this problem?
0
Comment
Question by:pdw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 1163600
I compiled it with MS VC++ v4.2, it produced 0 error(s), 0 warning(s). Everything is fine. Use the makefile provided by the example, MS VC++ v4.2 creates .mak and .mdp for you.

0
 

Author Comment

by:pdw
ID: 1163601
Thanks for the reply.  I did manage to get it to link by constructing the project from the makefile, and from this I figured out what on the linker command line was wrong - for some reason it had decided that this was a console app.  doh!  I'm new to VC.....

Thanks!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question