Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 321
swcraft Avatar asked Oct 20 '11 18:10

swcraft


1 Answers

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.

like image 108
anatolyg Avatar answered Sep 28 '22 20:09

anatolyg