Solved

VC++ Link Error

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

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…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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 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.

734 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