C ++ Excel加载项加载错误:Excel将XLL文件加载为文本文件 [英] C++ Excel Add-in loading error: XLL file is loaded by Excel as text file

查看:540
本文介绍了C ++ Excel加载项加载错误:Excel将XLL文件加载为文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用C ++和 XLW库构建Excel的XLL加载项.

I'm building XLL add-ins for Excel, using C++ and XLW library.

它在我的PC以及许多其他计算机上都可以正常工作.但是在某些情况下,当我将XLL拖到新的Excel窗口中时,会出现此错误:

It works fine on my PC, and on many others. But in some cases, when I drag the XLL into a new Excel window, this error shows up:

您要打开的文件"my_addin.xll"位于不同的位置 格式比文件扩展名指定的格式大.验证文件是否为 没有损坏,并且是在打开文件之前来自受信任的来源.做 您要立即打开文件吗?

The file you are trying to open, 'my_addin.xll', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?

如果单击yes,则Excel将打开XLL作为文本文件,显示如下内容:

If click yes, then Excel will open the XLL as a text file, showing something like this:

MZÿÿ¸@Í!¸LÍ!!此程序无法在DOS模式下运行.

MZÿÿ¸@ Í!¸LÍ!This program cannot be run in DOS mode.

在第一行.预计不会发生这种情况.可能是什么原因?

right at the first row. This is not expected to happen. What could be the reason for that?

这是所有计算机的系统配置:

This is the system configuration of all machines:

  • Microsoft Windows 7 Professional 64位(操作系统)
  • Microsoft Excel 2010 32位

推荐答案

总而言之,错误代码This program cannot be run in DOS mode.通常与以下问题之一相关:

To summarize, the error code This program cannot be run in DOS mode. is usually related to one of the following issues:

  1. XLL是使用/MD标志构建的,但是最终用户没有必需的CRT DLL.

  1. The XLL is built with the /MD flag, but end-users do not have the required CRT DLLs.

XLL是在错误的平台上编译的;例如平台x64用于构建XLL,然后将其加载到32位Excel中(反之亦然).

The XLL is compiled with the wrong platform; e.g. Platform x64 being used for building your XLL, and then it is loaded in 32-bit Excel (or vice-versa).

缺少一个外部DLL依赖项.

There is a missing external DLL dependency.

使用/MD标志(运行时库的特定于多线程和特定于DLL的版本)构建了一个外部DLL依赖项.在这种情况下,如果最终用户具有正确版本的CRT(用于构建外部DLL的版本),则没有问题.否则,强烈建议您使用/MT标志(多线程,运行时库的静态版本)重建外部DLL(如果可能).甚至更好的是,将其静态链接到您的XLL(使用静态.lib文件作为第三方组件构建的输出).

There is an external DLL dependency which has been built with the /MD flag (multithread-specific and DLL-specific version of the run-time library). In this case, there is no problem if end-users have the correct version of the CRT (the one that has been used to build the external DLL). Otherwise it is strongly recommended to rebuild your external DLL (if possible) with the /MT flag (multithread, static version of the run-time library). Or even better, to statically link it to your XLL (using static .lib file as the output of the build of your third party component).

我相信最后一个可能是您的情况.

I believe the last one might be your case.

这篇关于C ++ Excel加载项加载错误:Excel将XLL文件加载为文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆