我创建了一个ATL工程,加入了一些代码,编译时得到如下错误信息:
Linking...
Creating library ReleaseMinSize/mail.lib and object ReleaseMinSize/mail.exp
LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
不知是何原因,请指教!
Linking...
Creating library ReleaseMinSize/mail.lib and object ReleaseMinSize/mail.exp
LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
不知是何原因,请指教!
解决方案 »
- 怎么删除数据库表中的指定行?比如我要删除的第三行。代码该怎么写?
- vc2008 如何创建圆形按钮
- BN_CLICKED能用SendMessage()实现吗?如果不能还可以如何实现啊
- 求<<windows核心编程>>的配套光盘
- 请教高手!怎么样把对话框右上角那个关闭对话框的[×]去掉呢?
- 【BlueDog】———『关于汉化版本的ActiveBar运行问题,高分赠与有缘人』
- 急求CABAC算法源代码
- TRACE("this is a little map");在OnDraw()函数中是什么作用?
- 小问题!
- 我想求的工具条的高度,我用GetWindRect(&rect)不好用!!DEBUG跟踪,rect.top=rect.buttom,rect.left=rect.right!!如果谁知道求菜单条,还有状态条的高度!!!一起回答了!!!谢谢!!
- 关于使用OLE DB 连接Access 2000
- 使用VC的ATL向导生成的程序为什么不能打开Access2000
When you build a project of one of these types Win32 console application project
Active Template Library (ATL) DLL/EXE project with release configuration
A project with main as custom entry point
you may get the following error message from linker:
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main CAUSE
A Win32 console application requires the main function as the entry point. Linker returns this error message when it cannot find the main function in any of the files attached to the project.If your project is an ATL project, the release configurations for ATL projects define _ATL_MIN_CRT, which excludes CRT (C runtime) startup code from your .exe or .dll file. Linker gives this error message when you have _ATL_MIN_CRT defined and you are using the CRT functions that need CRT startup code.If the project is not one of the types listed in the "Symptoms" section of this article, but you are still getting the error, you might have main selected as an entry point symbol for the project in linker settings but have not provided a main function in the files added to the project. RESOLUTIONIf you have created a Win32 console application instead of a Win32 application by mistake, there are two ways to fix this problem:
From the Project menu, choose Settings, click the C/C++ tab, and change preprocessor definitions from WIN32, _DEBUG, _CONSOLE, and _MBCS to WIN32, _DEBUG, and _WINDOWS. Next, click the Link tab, and under Project Options, change /subsystem:console to /subsystem:windows. -or-
Create a new project and select Win32 Application instead of Win32 Console Application. Add the files to that project.
If you have created a Win32 console application and forgot to provide a main function, write a main function in one of the source files added to the project.
If you have selected main as the custom entry point by mistake, from the Project menu, choose Settings and click the Linker tab. Select output as the category and remove main from the entry-point symbol text box.
If your project is an ATL project, there are two ways to fix the problem:
Remove _ATL_MIN_CRT from the list of preprocessor definitions to allow CRT startup code to be included: From the Build menu, choose Settings. Hold down the CTRL key while selecting all of the release configurations. On the C/C++ tab, choose the General category, and then remove _ATL_MIN_CRT from the preprocessor definitions edit box.-or-
If possible, remove calls to CRT functions that require CRT startup code and use their Win32 equivalents. For example, use lstrcmp instead of strcmp. Known functions that require CRT startup code include the string and floating point functions.