I get the error message "LINK: error LNK2001: unresolved external symbol _WinMainCRTStartup"

Please, help. In Visual Studio 2008, I get the following errors.

============================================================ 1>Microsoft (R) Windows Resource To Object Converter Version 9.00.30729.01 1>Copyright (C) Microsoft Corporation. All rights reserved. 1>adding resource. type:ICON, name:1, language:0x0409, flags:0x1010, size:744 1>adding resource. type:ICON, name:2, language:0x0409, flags:0x1010, size:296 1>adding resource. type:GROUP_ICON, name:128, language:0x0409, flags:0x1030, size:34 1>adding resource. type:DIALOG, name:100, language:0x0409, flags:0x1030, size:374 1>adding resource. type:DIALOG, name:102, language:0x0409, flags:0x1030, size:784 1>adding resource. type:VERSION, name:1, language:0x0409, flags:0x30, size:928 1>adding resource. type:STRING, name:7, language:0x0409, flags:0x1030, size:68 1>LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup 1>.\Release/DiskTest.exe : fatal error LNK1120: 1 unresolved externals 1>Build log was saved at "file://c:\WinIRDir\Utilities\DiskTest\Release\BuildLog.htm" 1>DiskTest - 2 error(s), 0 warning(s) 1>Build log was saved at "file://c:\WinIRDir\Utilities\CommApp\Release\BuildLog.htm" ============================================================== 

Here is the situation. - DiskTest.exe is one of three projects in my solution - This project is perfect for Debug x64, Release x64 and Debug Win32. Release Win32 is the only one that generates these errors. - I spend hours comparing property pages for all 4 configuration / machine configurations, and I'm sure that no properties are missing from one version to another. I paid special attention to "Additional Dependencies", "Additional Library Directories", "Login", etc. Of course, .lib file paths point to \ Debug or \ Release and \ x86 or \ x64 for the appropriate configuration or platform.

The only "additional dependency" of this project is SBF_Util.lib and SBF_Utild.lib for Debug. I was convinced that all 4 versions (debug win32 and x64 and Release win32 and x64) of this library exist in the folder specified in each "additional library directory". I also checked dumpbin on each version of the library to make sure the platform is consistent.

I saw other situations in which there is no main entry point, but in this case all other versions arise without problems, only the Win32 Relase version generates this error, so I don’t think I need to change anything in the code.

Can anyone give any clues ?, I have no ideas. Any ideas would be greatly appreciated. Thanks.

+4
source share
4 answers

INCREDIBLE !!!

I found a problem! It was an incredibly simple thing that caused this crypto error: β€œSPACE”

It turns out that under Configuration-> C / C ++ β†’ OutputFiles-> Object File Name: I had: "$ (IntDir) \"

I did not notice the place until I paid very close attention to the Kdiff3 window, and noticed this little underline to signal a space. This place was there for several months, since this project was left unattended (before I went on board), because no one could find a fix for it, so they just stopped using it. Most likely, copy-paste error.

Thanks to all the guys for your ideas. Especially the first answer from Xearinox, which made me think about comparing all the modes. I will try to find the time to write a tool for parsing project / solution files into a four-column sheet listing all the properties for all configurations and platforms, so we can easily compare them. Thanks again.

+3
source

Open the project settings page, go to Linker β†’ System and study the SubSystem property. Make sure that it is set to the same value in all project configurations by switching the configuration from the configuration drop-down list.

Assuming that your intended entry point is main (or one of its variants, for example _tmain or wmain ), you must make sure that you use CONSOLE to use the SubSystem property.

+2
source

WinMain as an entry point is missing.

+2
source

In my case, the file I was trying to compile had the wrong properties.

I created a file with a changed symbol in the file extension, and so my project gave it the wrong element type: Does not participate in build .

After renaming, I turned on its properties and changed the element type to <reset to default> , which reset to C/C++ Compiler .

0
source

Source: https://habr.com/ru/post/1412703/


All Articles