编译ATL工程的连接错误:msvcrt.lib(dllsupp.obj) : error LNK2005: __fltused already defined in StdAfx.obj

ecai 2002-04-25 09:12:32
一个ATL工程, DEBUG版本已经通过,编译 ReleaseMinSize版本时出现以下错误:

Linking...
msvcrt.lib(dllsupp.obj) : error LNK2005: __fltused already defined in StdAfx.obj
msvcrt.lib(dllsupp.obj) : warning LNK4006: __fltused already defined in StdAfx.obj; second definition ignored
Creating library ReleaseMinSize/VideoMod.lib and object ReleaseMinSize/VideoMod.exp
ReleaseMinSize/VideoMod.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

说明:
1: _fltused 是在 atlimpl.cpp中定义的变量(Line 106)

#if !defined(_M_ALPHA) && !defined(_M_PPC)
//RISC always initializes floating point and always defines _fltused
extern "C" const int _fltused = 0;
#endif

2: atlimpl.cpp 在 stdafx.cpp 中被包含(AppWizard自动生成的代码):

// stdafx.cpp
#include "stdafx.h"

#ifdef _ATL_STATIC_REGISTRY
#include <statreg.h>
#include <statreg.cpp>
#endif

#include <atlimpl.cpp>

Thank first!
...全文
207 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
masterz 2002-04-25
  • 打赏
  • 举报
回复
someone declare this as a bug of VC.
ecai 2002-04-25
  • 打赏
  • 举报
回复
Problem solved! But Why?

When the ATL COM AppWizard generates the default project, it defines the macro _ATL_MIN_CRT. This macro is defined so that you don't bring the C Run-Time Library into your code if you don't need it.

和 _fltused有什么关系?if defined _ATL_MIN_CRT, we may get errors like this:

LIBCMT.LIB(crt0.obj) : error LNK2001: unresolved external symbol _main

But now there is a multiply defined symbol, it puzzels me!
I will give you score first, but please give me further explanation
masterz 2002-04-25
  • 打赏
  • 举报
回复
try to remove the preprocessor _ATL_MIN_CRT

3,245

社区成员

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

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