• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

VC++ Link Error

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
kj7ny
Asked:
kj7ny
1 Solution
 
trilloCommented:
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
 
jkrCommented:
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
 
kj7nyAuthor Commented:
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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now