Solved

LNK2001: undefined external "_main"

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
GUI: DIalog Stacking and Popping in MS C++ 4 82
How to convert MFC::CString to UTF8 wchar_t* 10 287
Safe conversion? 4 72
Android development question 2 54
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

828 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