?
Solved

VC++ Link Error

Posted on 1998-11-29
3
Medium Priority
?
195 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
[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
3 Comments
 
LVL 2

Accepted Solution

by:
trillo earned 600 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
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…
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.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

801 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