用gcc链接器链接pgi编译的库 [英] linking pgi compiled library with gcc linker
问题描述
我想知道如何将pgc ++编译的代码(blabla.a)与使用c ++或g ++ GNU编译器编译的主代码链接. 目前,使用默认gnu c ++链接器链接时会出现如下错误: 未定义对__pgio_initu的引用
I would like to know how to link a pgc++ compiled code (blabla.a) with a main code compiled with c++ or g++ GNU compiler. For the moment linking with default gnu c++ linker gives errors like: undefined reference to `__pgio_initu'
推荐答案
正如前面的人已经指出的那样,PGI在使用pgc++
命令时支持G ++名称转换.从此输出来看,我猜您正在与g ++而不是pgc ++链接.当使用pgc ++作为链接器以便找到PGI库时,我获得了最大的成功.如果不是这样,则可以使用pgc++ -dryrun
链接可执行文件以获取完整的链接行,然后从此处跳过-L
和-l
选项以获取相同的库.
As the previous person already pointed out, PGI supports G++ name mangling when using the pgc++
command. Judging from this output, I'm guessing that you're linking with g++ rather than pgc++. I've had the most success when using pgc++ as the linker so that it finds the PGI libraries. If that's not an option, you can link an executable with pgc++ -dryrun
to get the full link line and past the -L
and -l
options from there to get the same libraries.
这篇关于用gcc链接器链接pgi编译的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!