【问题标题】:Excel plug-in error moving from WindowsXP 32 bit to Windows7 64 bitExcel 插件错误从 Windows XP 32 位移动到 Windows 7 64 位
【发布时间】:2026-02-23 22:15:01
【问题描述】:

我正在调试一个 Excel 2010 插件,由其他人完成,从 WindowsXP 32 位迁移到 Windows 7 64 位。

我在 XLCALL.CPP 文件中遇到编译时错误,该文件是“Microsoft Excel 开发人员工具包 - 版本 14.0”的一部分。

这是有错误的代码:

...
typedef int (PASCAL *EXCEL12PROC) (int xlfn, int coper, LPXLOPER12 *rgpxloper12, LPXLOPER12 xloper12Res);

HMODULE hmodule;
EXCEL12PROC pexcel12;

__forceinline void FetchExcel12EntryPt(void)       // <<< error, line 36
    {
        if (pexcel12 == NULL)
        {
            hmodule = GetModuleHandle(NULL);
            if (hmodule != NULL)
            {
                pexcel12 = (EXCEL12PROC) GetProcAddress(hmodule, EXCEL12ENTRYPT);
            }
        }
    }

这是错误信息:

S:\3rdparty\2010 Office System Developer Resources\Excel2010XLLSDK\SRC\XLCALL.CPP|36|error: expected constructor, destructor, or type conversion before 'void'

我不知道这个错误的可能原因。在 XLCALL.H 包含文件中没有类定义,只有 POD 结构,因此它不应该查找构造函数/析构函数。错误所指的函数是该文件的本地函数(即未在包含文件中声明)。不包括其他文件。

感谢您的帮助!

平台:
Windows 7 64 位
Excel 2010
MinGW32
代码块 10.05

【问题讨论】:

    标签: c++ excel plugins windows-7 windows-xp


    【解决方案1】:

    好吧,看来要开发必须与微软产品配合使用的C++工具,最好的办法就是使用微软Visual C++。

    这样做,所有这些问题都消失了。

    【讨论】: