Solved

VC++ Link Error

Posted on 1998-11-29
3
192 Views
Last Modified: 2010-04-01
Installed Visual C++ 5.0
Tried...
#include <iostream.h>
void main()
 {
  cout << "Hola Mundo.";
 }
...get
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/edit.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Any suggestions to cause/fix? Have no idea if this is easy, mod, or hard for you.  Is impossible for me.
0
Comment
Question by:kj7ny
3 Comments
 
LVL 2

Accepted Solution

by:
trillo earned 150 total points
ID: 1178781
The problem is that you started a new project using the "windows application" option, this will tell the linker to find a "WinMain" function instead of your "main" function.
You should follow next steps:
a) click on the New command in the file menu (or icon)
b) Click on the project tab
c) Select "console application".... (and give some name to the project, of course)
d) Click OK and include the file with the code you posted.

Now it should work
Trillo
0
 
LVL 86

Expert Comment

by:jkr
ID: 1178782
It'd be even easier to simply add '/subsystem:console' to the linker parameters instead of creating a new project... or simply compile it at the command line using 'cl myfile.cpp' without any parameters (well, if a lib is missing, you'll have to use '/link <anylib>.lib' as an additional parameter)...
0
 

Author Comment

by:kj7ny
ID: 1178783
Thank you! Trillo's suggestion worked. I haven't tried jkr's yet but am keeping it for the next time since this time it was just as easy to start over.  And to think I just went out and spent $35 on a book to try to figure out the cause of the problem ;)
The answer was worth increasing the points.
Thanks!!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
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 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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

679 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