user159402
user159402

Reputation:

VC++ LNK2001: unresolved external symbol only when compiling on 64bit

I have made a dll that compiles fine in 32bit mode, but when compiling in 64bit mode (both on a 32bit box cross compiling and on a native 64bit box) I get the above error. The symbol that it is complaining about are the following:

"struct return_info_ * __cdecl patch_file(char *,char *,char *)"

I am new to C++ but I think I have defined both the struct and the signature correctly. The struct "return_info_" is defined as follows:

typedef struct return_info_
{
    char *message;
    int code;
} return_info;

In the same header I have the signature of the function:

return_info* patch_file(char* oldfile, char* newfile, char* patchfile);

This is all in native c/c++ code, which is compiled as a statically linked library. I then have our main library which links to this and is a clr compatible binary. Any ideas why the 64bit compiler throws these errors?

Upvotes: 0

Views: 1133

Answers (1)

Reed Copsey
Reed Copsey

Reputation: 564323

The declaration in the header looks correct, but for some reason, in your 64bit build, the actual implementation not being found.

Is this defined in your library? It may not have been compiled correctly in its 64bit version.

If this is a function that's part of your application, make sure the correct source file is being included as part of the 64bit build process, as well.

Upvotes: 1

Related Questions