简体   繁体   中英

LNK2019 error when using XLCALL32.LIB on Visual Studio 2019

I am using an old C++ library that makes use of an external XLCALL32.LIB library file. This external library hasn't been updated in many years.

The comment in the XLCALL.H header file says below: /* ** Microsoft Excel Developer's Toolkit ** Version 5.0 */

I am using VS 2019 for a Debug x64 build and my linker errors are below:

error LNK2019: unresolved external symbol Excel4 referenced in function xxxxx error LNK2019: unresolved external symbol Excel4v referenced in function xlAutoOpen

A Debug Win32 build was successful but I get below strange error when loading the XLL file in Excel.

"Unable to initialize cable order data. Missing static data"

I am using Microsoft Excel for Office 365 32-bit.

I couldn't find any help online for this error and so I am trying a x64 build but I am stuck with the linker errors mentioned above.

Can someone advise if I should be doing a 32-bit build and if Microsoft has a newer XLCALL32.lib that I should be using.

Greatly appreciate your help!

You cannot use a 32-bit DLL or import library (LIB) in a 64-bit build. So, yes, you must do a 32-bit build if you plan to use this LIB. You will also need to do a 32-bit build anyway, since you're targeting a 32-bit version of Office.

Additionally, since this LIB was surely built with an older version of the compiler, it is not surprising that you would be seeing errors. LIB files do not maintain binary compatibility across compiler versions. (And especially not across major version releases of the compiler.)

I would recommend obtaining a newer version of this library. The documentation is here . It should be shipped with the Microsoft Office SDK. Download the correct SDK matching the version number of Office that you are targeting with your C++ code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM