Reputation: 22241
I have two projects in one solution in Visual Studio. One of the projects (application) depends on another (library). The library has a method:
int foo(_TCHAR*);
It is properly defined in header and implemented. In the application I call the method like this:
int bar(_TCHAR* str) {
return foo(str);
}
The error I am getting is
error LNK2001: unresolved external symbol "public: int __cdecl foo(char *)"
The method signature is exactly the same and the same type of variable is being used.
Upvotes: 3
Views: 1713
Reputation: 22241
The reason behind the linker not being able to match the methods is the mismatched Character Set
option in projects General Properties
page.
The library project had this option set to Use Unicode Character Set
and the application to Use Multi-Byte Character Set
.
Unifying the Character Set in both projects fixed this error.
Upvotes: 7