简体   繁体   English

尝试在 XE 中访问 RAD Studio 10.2 编译库时出现链接错误

[英]Link error when trying to access a RAD Studio 10.2 compiled lib in XE

I need to have a latest feature of IniFile, so compiled my XE.lib project in RAD Studio 10.2.我需要 IniFile 的最新功能,所以在 RAD Studio 10.2 中编译了我的 XE.lib 项目。 Compilation is successful, but while using it in my XE project, I get an "unable to open SChore.obj" linker error.编译成功,但是在我的 XE 项目中使用它时,出现“无法打开 SChore.obj”linker 错误。 How to resolve this error?如何解决此错误?

This "Schore.dll is present in "C:\Program Files (x86)\Embarcadero\Studio\19.0\lib\win32\release". I tried adding this path to the includes path of both.lib, as well as the XE project, it the error still exists.此“Schore.dll 存在于“C:\Program Files (x86)\Embarcadero\Studio\19.0\lib\win32\release”中。我尝试将此路径添加到 both.lib 以及 XE 的包含路径项目,它的错误仍然存在。

Any suggestion on resolving this error?有关解决此错误的任何建议?

You can't share a .lib file across different versions of the compiler.您不能在不同版本的编译器之间共享.lib文件。 You need separate versions of the .lib that have been compiled specifically for each compiler.您需要为每个编译器专门编译的单独版本的.lib

Which means you can't use a 10.2 .lib in XE.这意味着您不能在 XE 中使用 10.2 .lib What you can do instead is compile your lib code in 10.2 into a DLL, and then you use that DLL in your XE project.您可以做的是将 10.2 中的 lib 代码编译成 DLL,然后在 XE 项目中使用该 DLL。

If you want to statically link to a DLL's functions at compile-time, you can use XE's version of C++Builder's IMPLIB tool to create a new import .lib from the DLL, and then add that to your XE project.如果您想在编译时静态链接到 DLL 的函数,您可以使用 XE 版本的 C++Builder 的IMPLIB工具从 DLL 创建一个新的导入.lib ,然后将其添加到您的 XE 项目中。 Otherwise, you can use the Win32 LoadLibrary() and GetProcAddress() functions to access the DLL's functions dynamically at runtime.否则,您可以使用 Win32 LoadLibrary()GetProcAddress()函数在运行时动态访问 DLL 的函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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