错误 C2733 不允许重载函数“函数”的第二个 C 链接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7840203/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 17:35:04  来源:igfitidea点击:

error C2733 second C linkage of overloaded function 'function' not allowed

c++cvisual-studio-2010visual-c++

提问by swcraft

I am trying to compile old cpp MFC project in Visual Studio 2010 pro.

我正在尝试在 Visual Studio 2010 pro 中编译旧的 cpp MFC 项目。

It uses dll which is compiled using Labview, and I am adding this information because I don't know what is causing the error message..

它使用使用 Labview 编译的 dll,我正在添加此信息,因为我不知道是什么导致了错误消息..

The error messages show up on multiple functions, all same error type.

错误消息显示在多个函数上,所有相同的错误类型。

error C2733: second C linkage of overloaded function 'function name' not allowed.

the 'function name' includes: 'StrCatW', 'StrCmpNW', 'StrCmpW', 'StrCpyNW', and 'StrCpyW'

“函数名称”包括:“StrCatW”、“StrCmpNW”、“StrCmpW”、“StrCpyNW”和“StrCpyW”

I found a similar caseon the web.

我在网上找到了一个类似的案例

Although the suggestion in the link didn't solve in my case and I still see the same error messages.

尽管链接中的建议在我的情况下没有解决,但我仍然看到相同的错误消息。

Thanks in advance for anyone trying to help.

预先感谢任何试图提供帮助的人。

回答by anatolyg

I have no experience with MFC, anyway i'll try to answer. Such error message appears when an extern "C"function is declared with a different set of parameters. For example:

我没有使用 MFC 的经验,无论如何我会尝试回答。当extern "C"使用一组不同的参数声明函数时,会出现此类错误消息。例如:

extern "C" int myfunc(int);
extern "C" int myfunc(char);

In your case, the two declarations are probably related to char*:

在您的情况下,这两个声明可能与char*

extern "C" char* StrCatW(char*, char*);
extern "C" wchar_t* StrCatW(wchar_t*, wchar_t*);

Try turning off Unicode support in your solution: i guess, if the dll is really old, it somehow declares StrCatWwith char*arguments, conflicting with some other declaration.

试着在你的解决方案关闭Unicode支持:我想,如果DLL是真的老了,它在某种程度上声明StrCatWchar*论点,与其他一些申报冲突。

If that doesn't help, turn on preprocessed output (/Ecompiler switch, as far as i recall) - it will output a very large file, so look for StrCatWin it, maybe it will give you some clue on what is going on.

如果这没有帮助,请打开预处理输出(/E编译器开关,据我所知)-它将输出一个非常大的文件,因此请StrCatW在其中查找,也许它会给您一些有关正在发生的事情的线索。