问题描述
我正在处理一个从 x32
位到 x64
的迁移项目.我在这里使用此代码:
I am working on one migration project from x32
bit to x64
.Here I am using this code:
{$L com_1.obj}
{$L com_is1.obj}
{$L com_2.obj}
但是在编译代码时我收到错误
But while compiling code I am getting error as
[dcc64 Error] XXX.dpr(919): E2045 Bad object file format: 'E:MyProjcom_sha.obj'
我无法追踪它发生的原因.
I am not able to trace why it is happening.
是不是因为编译x64位delphi项目时使用了32位obj文件?
Is it due to 32 bit obj file used for compiling x64 bit delphi project?
如果是的话,我也尝试用 x64 位环境创建一个 obj 文件.
If it is I have also tried to create a obj file with x64 bit environment.
有人可以帮我解决这个问题吗?
Can anyone please help me on this?
我正在使用 Delphi 10 Seattle
.
推荐答案
不能在 64 位编译器中使用 32 位对象.您必须使用 64 位编译器重新编译您的代码.
You cannot use a 32 bit object with the 64 bit compiler. You must recompile your code with a 64 bit compiler.
您可以使用多种不同的编译器来执行此操作.尽管我听说有人使用 gcc 取得了成功,但我从未设法做到这一点.我相信可以使用基于现代 Clang 的 Embarcadero 编译器,但我个人没有这方面的经验.我一直使用 Microsoft 编译器来创建 64 位对象.当然,这就是 Embarcadero 自己为链接到 RTL 的 zlib 之类的库所做的.
You can use a number of different compilers to do this. Although I have heard of people succeeding with gcc I have never managed to do that. I believe that the modern Clang based Embarcadero compiler can be used, but I personally have no experience of that. I have always used the Microsoft compiler to create 64 bit objects. And certainly this is how Embarcadero themselves have done it for libraries like zlib that they link to their RTL.
这篇关于E2045 错误的目标文件格式:“XXX.obj"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!