swcraft
swcraft

Reputation: 2112

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

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

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..

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'

I found a similar case on 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.

Upvotes: 16

Views: 36749

Answers (1)

anatolyg
anatolyg

Reputation: 28278

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:

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

In your case, the two declarations are probably related to 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 StrCatW with char* arguments, conflicting with some other declaration.

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

Upvotes: 21

Related Questions