Benjamin Cuningham
Benjamin Cuningham

Reputation: 906

What is LNK2001 unresolved external symbol __imp___strdup?

I am moving a class from one project to another in Visual Studio 2015 and this is the error that I get. I cannot find any other examples of this specific error.

Upvotes: 0

Views: 5062

Answers (1)

__imp_ is __declspec(dllimport), and the next underscore indicates that the function is extern "C" and __cdecl, leaving _strdup as the function name. Therefore, going by the MSDN documentation linked in the comments, the symbol __imp___strdup is:

extern "C" __declspec(dllimport) char* __cdecl _strdup(const char* strSource);

This function requires the header <string.h>

It would appear that the project you moved your class into doesn't use one of the MS libraries that contains the function, for some reason. That's my guess, at least. Try checking each project's properties and seeing if they use the same .lib files?

Upvotes: 3

Related Questions