Solved

VC++ Link Error

Posted on 1998-11-29
3
188 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
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 tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

705 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

20 Experts available now in Live!

Get 1:1 Help Now