简体   繁体   English

使用gcc时,如何使用由Intel编译器编译的库?

[英]How can I use libraries which were compiled by Intel compiler, when I'm using gcc?

I'm running on Linux and I got a library (.a) which was compiled by Intel compiler. 我在Linux上运行,并且有一个由英特尔编译器编译的库(.a)。

I'm trying to link against this static library (I'm using g++) and getting link error: 我正在尝试链接到此静态库(我正在使用g ++),并遇到链接错误:

undefined reference to intel_fast_memcpy

I requested to get the library as a shared library (.so) which was compiled by intel compiler too, and I got the same error. 我请求将该库作为共享库(.so),该库也由intel编译器进行了编译,但出现了同样的错误。

How can I use libraries which were compiled by Intel compiler, when I'm using gcc? 使用gcc时,如何使用由Intel编译器编译的库?

As far as I know, there is no way to link C++ client code against C++ libraries built with different compiler (even same compiler name but different versions don't work). 据我所知,无法将C ++客户端代码与使用不同编译器构建的C ++库链接(即使相同的编译器名称,但不同的版本也不起作用)。 C++ -linkage is not stanrardised. 没有建立C ++链接。

However, C-linkage is. 但是,C链接是。 If you wrap a library to export the symbols as C, (external "C"{ } - block in your code) you could use these libraries with any compiler, and even not only with C/C++; 如果包装一个库以将符号导出为C(外部“ C” {}-代码中的块),则可以将这些库与任何编译器一起使用,甚至不仅限于C / C ++。 For doing this, the wrapper-lib should be built with intel-compiler in your case. 为此,在您的情况下,应该使用intel-compiler构建wrapper-lib。

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

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