Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi . I have a problem, I created a CLR project and added the form, the entry point set to "Main" and Sub System to Windows ... Okey everything fine and beautiful. But when I click on debugging, I get this error
1>------ Build started: Project: InfoMEN, Configuration: Debug x64 ------
1>LINK : error LNK2001: unresolved external symbol Main()
1>c:\Users\gabri\source\repos\InfoMEN\x64\Debug\InfoMEN.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "InfoMEN.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


What I have tried:

I have not found a solution for that error
Posted
Updated 18-Jan-18 0:58am
Comments
Richard MacCutchan 18-Jan-18 6:36am    
You probably have main spelled in lower case. .NET needs it spelled as in the error message above.
Gabriel Leonte 18-Jan-18 6:40am    
I tried "main" , but nothing :(
Richard MacCutchan 18-Jan-18 6:47am    
Of course not, the message tells you that it should be spelled "Main".
Gabriel Leonte 18-Jan-18 6:50am    
i write "Main" but nothing... same error
Gabriel Leonte 18-Jan-18 6:55am    
Wait wait... i wirite Main but Visual studio decide to set "main"... I solved that with edit Button. Thanks for help ^^

When you created the project, you made the wrong choice of application type. When asked whether your project was a console application or a windows application or a DLL or a static library, you made the wrong chose windows application (wrong choice).

Go back, start over again, go to File -> New -> Project -> Win32 Console Application -> name your app -> click next -> click application settings.

For the application type, make sure Console Application is selected (this step is the vital step).

The main for a windows application is called WinMain, for a DLL is called DllMain, for a .NET application is called Main(cli::array ^), and a static library doesn't have a main. Only in a console app is main called main


From MSDN:error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup[^]
 
Share this answer
 
Comments
Gabriel Leonte 18-Jan-18 6:46am    
I want to use CLR FORM no Console aplication :face_palm:
Gabriel Leonte 18-Jan-18 6:48am    
I want a graphic interface with Form... no a console32 App and my error is LNK2001 no LNK2019
Thank you
Richard MacCutchan 
"You probably have main spelled in lower case. .NET needs it spelled as in the error message above."
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900