用Intel C/C++编译器编译ATL或WTL程序时出现的问题

PowerDSP 2004-12-25 03:34:08
我用VC6,编译链接ATL/WTL例子程序没有问题。用Intel C/C++编译debug版也没有问题,但是编译Release版本的时候,链接时总出现如下错误提示:
Linking...
IPO Error: unresolved : _main
Referenced in LIBC.lib(crt0.obj)
link: executing 'E:\PROGRA~1\MICROS~1\VC98\Bin\link.exe'
LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
ReleaseUMinDependency/test4.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

test4.exe - 3 error(s), 0 warning(s)
我想也许这和ATL内部提供了C/C++开发的程序所必须具有的C启动代码的替代部分有关吧,但是为什么用VC本身来编译链接就没有问题呢?又为什么使用Intel C/C++编译器时只在Release版出错呢?请指点。
...全文
112 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hony688 2004-12-25
  • 打赏
  • 举报
回复
intel编译器vc编译器之间有差异引起的吧,IBM的C编译器也有类似的情况
PowerDSP 2004-12-25
  • 打赏
  • 举报
回复
按照MSN的帮助,问题已解决:
This error occurs if you are using CRT functions that require CRT startup code. The Release configurations define _ATL_MIN_CRT, which excludes CRT startup code from your EXE or DLL. To avoid this error, do one of the following:

Remove _ATL_MIN_CRT from the list of preprocessor defines to allow CRT startup code to be included. On the Project menu, click Settings. In the Settings For: drop-down list, choose Multiple Configurations. In the Select project configuration(s) to modify dialog box that appears, click the check boxes for all Release versions, and then click OK. On the C/C++ tab, choose the General category, then remove _ATL_MIN_CRT from the Preprocessor definitions edit box.

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 are some of the string and floating point functions.

但是疑惑的是为什么用Intel编译器才出现这个问题而用VC本身的编译器就可以链接呢?
天限天空 2004-12-25
  • 打赏
  • 举报
回复
http://blog.csdn.net/newkey007/archive/2004/11/25/194241.aspx
kingzai 2004-12-25
  • 打赏
  • 举报
回复
ATL下release 编译也有这个问题。
PRB: LNK2005 Errors on New and Delete When Defining _ATL_MIN_CRT
ID: Q184235
PowerDSP 2004-12-25
  • 打赏
  • 举报
回复
按照MSND的文档,VC编译器也应该出现这个问题,但是实际上没有。我的VS打了SP5,不知道是否是这个原因用VC编译链接并未出问题。

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧