简体   繁体   中英

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.

I'm trying to link against this static library (I'm using g++) and getting link error:

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.

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

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++ -linkage is not stanrardised.

However, C-linkage is. 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++; For doing this, the wrapper-lib should be built with intel-compiler in your case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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