Solved

LNK2001: undefined external "_main"

Posted on 1997-05-21
2
210 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
2 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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 goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
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.

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now