我在一个空的ATL com项目中,想使用
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
这几个头文件中的类,
结果在Debug时,一切OK没有问题,
但我在Release minsize时,就报
Generating Code...
Linking...
Creating library ReleaseMinSize/ATLTest.lib and object ReleaseMinSize/ATLTest.exp
LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
ReleaseMinSize/ATLTest.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.但我能够包含比如#include <vector>
这样的stl头文件,但不能使用上面的四个,而且是Debug可以,release不可以。
不知是为什么?
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
这几个头文件中的类,
结果在Debug时,一切OK没有问题,
但我在Release minsize时,就报
Generating Code...
Linking...
Creating library ReleaseMinSize/ATLTest.lib and object ReleaseMinSize/ATLTest.exp
LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
ReleaseMinSize/ATLTest.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.但我能够包含比如#include <vector>
这样的stl头文件,但不能使用上面的四个,而且是Debug可以,release不可以。
不知是为什么?
解决方案 »
- 请教一个关于CAsyncSocket 的问题
- 虚拟摄像头如何读取视频文件
- 关于ftp服务器的疑问.
- RE:COM问题....
- 请问在VFW中怎样实现图象的拉伸显示?即实际采集176*144,但是显示为800*600?
- 请问这种处理方式是否可行?
- xml添加节点时总是默认在最后一个节点后追加,如何能把新节点添在第一个节点前?
- 难度稍高,能改变slider里面的那个滑块的形状么??????
- 十六进制字符串 转换为 十进制
- 怎样用MFC写一个学生管理程序,调用数据库,并对数据库进行操作?
- 求助!!!一个很菜的问题
- 请问:消息IMC_GETCONVERSIONMODE是哪个头文件中定义的?它的值是多少?
String comparison routines
Memory allocation routines
Global objects with constructors
C++ exception handling (/GX)
ATL is aimed at minimizing the image size and the reliance on run-time DLLs. It provides alternative implementations for common CRT APIs that would otherwise require the CRT startup code. The use of these APIs is controlled by the _ATL_MIN_CRT macro. Using _ATL_MIN_CRT does not mean that you cannot use the CRT routines. However, if you use the routines that require the CRT startup code, then you will get a linker error that _main is unresolved. Providing your own implementation of _main does not solve this problem. If C++ exceptions (/GX) are enabled, then you must link in the startup code. The _ATL_MIN_CRT macro cannot be used in this case. MFC requires code to be compiled with the /GX option. Therefore, you cannot use _ATL_MIN_CRT in conjunction with MFC. You can use SEH (structured exception handling), __try, and __except with _ATL_MIN_CRT, because the startup code is not required. In many cases, since most of the CRT source code ships with the product, you can use some of this code and replace only parts of it with system calls to avoid the startup code. To find out what is causing the problem, do one of the following:
Open the Project Settings dialog box, select the Link tab, and click Input in the Category box. Type LIBCMT.LIB in the Ignore libraries text box. Now do a build. You will get a list of unresolved externals. This list contains the CRT routines you are using. Look for the routines that you think may require the startup code.
Turn on the /VERBOSE linker option. From the resulting linker output, you can find a list of routines that require the CRT startup code.
If you need the startup code, then remove the _ATL_MIN_CRT definition from the Project Settings. You can also dynamically link to CRT. This reduces your image size but requires Msvcrt.dll. When building as Release, the default option is to statically link to CRT and use _ATL_MIN_CRT. This gives a smaller image size than dynamically linking to CRT, at least when the startup code is avoided and the CRT APIs used by AppWizard are used.