How to resolve particular LNK2001 error?

In order for our project to compile and link successfully the compiler option 'Treat WChar_t as built in type' has always been set to No.

Now we are adding a new feature through the use of a 3rd part library file. Through testing it appears that in order to use this library successfully the above compiler option must be set to Yes or I will get a linking error:

Error LNK2001 unresolved external symbol "public: int __thiscall BluetoothClient::Connect(unsigned short *)" (?Connect@BluetoothClient@@QAEHPAG@Z) cmj C:\dev\Products\cmj\cmj\VC7 Project\main.obj

The BluetoothClient::Connect method accepts one variable of type LPWSTR which is defined in terms of WCHAR which is defined in terms of wchar_t (winnt.h).

If I set the compiler option to yes it will link successfully (and run) in my test project. If I set it to yes for the real project it causes hundreds of C2664 compiler errors in other areas of the project where variables of type wchar_t and tchar, etc, are passed as arguments.


Does anyone have any ideas of how I could resolve this linking error without turning on the 'Treat WChar_t as built in type' compiler option?
I can provide more details if anyone asks.
when compiling main.cpp you are seeing one declaration of .Connect(), the one that ask for a unsigned short (WChar_t deactivated)
when compiling bluethooth.cpp you are providing another definition of .Connect(), which seems to have WChar_t activated. (may use nm to check)

Check that both are being compiling with the same flags, that you are not using an older version (make clean) and that the implementation does use the correct type.

Try to provide a minimal example with as little as possible of external libraries (upload to github or similar)


> hundreds of C2664 compiler errors
I'm not going to search for that error code, the compiler should give you a meaningful message, post that.
Topic archived. No new replies allowed.