Solved

LNK2001: undefined external "_main"

Posted on 1997-05-21
2
236 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
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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel/Word Add-in in what language? 5 118
trigs fail! I thought I knew how to do trignometry 3 67
c++, dynamic object by json 1 42
designing in object programming 12 79
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

803 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