描述:
选择Unicode debug时并无错,但是选择Win32 Unicode Release MinSize 或是 Unicode Release MinDependency就报以下出错信息:
Creating library ReleaseUMinSize/FIOL_DB.lib and object ReleaseUMinSize/FIOL_DB.exp
LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
ReleaseUMinSize/FIOL_DB.dll : fatal error LNK1120: 1 unresolved externals
****************** 请问是如何解决 **************
解决方案1:
remove _ATL_MIN_CRT
解决方案2: 1、VC环境中按Alt+F7启动Project Settings对话框
2、选择Link属性页,在类别组合框中选择Output
3、对Entry-Point Symbol编辑框中输入wWinMainCRTStartup即可。
以下信息摘自MSDN
Q. What problems might be encountered when using _ATL_MIN_CRT? What causes the linker error that _main is unresolved during Release builds?
The following also applies to ATL 3.0:
A. This usually happens when the C Run-Time (CRT) startup code is required for some CRT functions. You can either remove all references to the CRT functions that require the startup code or remove the _ATL_MIN_CRT preprocessor definition from your compiler settings.
You can link statically or dynamically to the CRT. Statically linking causes the CRT code to be placed in your executable image and you do not need to have the CRT DLL (Msvcrt.dll). If you dynamically link to the CRT, references to the code in Msvcrt.dll are placed in your image. For your image to run, Msvcrt.dll must be present. Even when dynamically linking to the CRT, there can still be some code statically linked, such as DllMainCRTStartup.
An entry point, explicitly or implicitly specified when linking, is called by the operating system after loading the image. For a DLL, the default entry point is DllMainCRTStartup. For an EXE, it is WinMainCRTStartup. You can override the default with the /ENTRY linker option. The CRT provides an implementation for DllMainCRTStartup, WinMainCRTStartup, and wWinMainCRTStartup (UNICODE entry point for an EXE). These entry points (CRT startup code) call constructors on global objects and initialize some data structures used by some CRT functions. This startup code adds about 25K to your image when statically linking.