954,180 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Linking Error

i am programming in Microsoft Visual c++ 6.0 and I have two linking
errors that I do not know what they mean. Can someone please help.

Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/Programming Project 1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

somer2412
Newbie Poster
6 posts since Oct 2004
Reputation Points: 10
Solved Threads: 0
 

It means you're using the wrong project type. You created a Win32 application (which requires WinMain instead of main) and then treated it as if it were a console application (by using main instead of WinMain).

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

just replace your int main(void) function with :

int WINAPI WinMain(

    HINSTANCE hInstance,	
    HINSTANCE hPrevInstance,	
    LPSTR lpCmdLine,	
    int nCmdShow 	
   )
CrazyDieter
Junior Poster
108 posts since Jul 2005
Reputation Points: 11
Solved Threads: 6
 

just replace your int main(void) function with :

int WINAPI WinMain(

    HINSTANCE hInstance,	
    HINSTANCE hPrevInstance,	
    LPSTR lpCmdLine,	
    int nCmdShow 	
   )


Brilliant! Destroy portability because you're too lazy to delete the project and try again. Since it's not obvious whether the OP wants portable C++ or Win32 C++, a better suggestion would be to create a new project that doesn't expect platform specific code to compile.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

I love you.

CrazyDieter
Junior Poster
108 posts since Jul 2005
Reputation Points: 11
Solved Threads: 6
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You