静态库函数调用中的COMDAT错误 [英] COMDAT error in static library function call

查看:155
本文介绍了静态库函数调用中的COMDAT错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.
我正在一个项目中,我必须从.lib文件调用某些函数..lib文件是在Visual Studio 2003中编译的,我也在从Visual Studio 2003的.lib文件进行函数调用.链接时,出现此错误 nafxcwd.lib(objcore.obj):致命错误LNK1179:无效或损坏的文件:重复的COMDAT''''.我尝试了/Gy和/H链接器选项,但无济于事.有人可以帮我调试此错误.该库只有.lib文件和.h文件.不能重新编译.lib文件..lib文件中的函数是类中包含的静态函数.
预先感谢.

Hello people.
I am working on a project where I have to call some functions from a .lib file.The .lib file was compiled in Visual Studio 2003 and I am making the function calls from the .lib file from Visual Studio 2003 as well. When linking, I am getting this error nafxcwd.lib(objcore.obj) : fatal error LNK1179: invalid or corrupt file: duplicate COMDAT '''' . I have tried the /Gy and /H linker options but to no avail. Can someone please help me debug this error.I have only the .lib file and the .h file for the library. Recompiling the .lib file is not an option.The functions in the .lib file are static functions contained in a class.
Thanks in advance.

推荐答案

静态库项目可能会遇到的一个问题是,当您在自己的另一个项目中与它们链接时,项目的编译设置必须与用于生成静态库的设置互补.由于您不再拥有静态库的原始源,因此您可能也不知道用于生成静态库的编译设置.您可能必须一次调整一次自己的编译选项,以便找到至少是互补的设置并允许进行链接.例如,一种这样的设置是使用多线程的还是单线程的C运行时.代码优化是另一个.同样,即使您使用的是VS 2003,如果它的服务包级别与用于生成静态库的服务包级别不同,那么这也可能是一个问题.
One of the problems that can be encountered with static library projects, is when you go to link with them, in another project of your own, the compile settings for your project need to be complimentary to the settings that were used to produce the static library. Since you no longer have the original source for the static library, you probably also don''t know what compile settings were used to produce it. You may have to adjust your own compile options, one at a time in order to find the setting that will at least be complimentary and allow the linking to occurr. For example, one such setting is whether to use the muti-threaded or the single threaded C runtime. Code optimizations are another. Also even though you are using VS 2003, if it is at a different service pack level than was use to produce the static library, that too might be an issue.


这篇关于静态库函数调用中的COMDAT错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆