链接器问题与libstdc ++。so.6在连接cuda [英] linker problem with libstdc++.so.6 in connection with cuda
本文介绍了链接器问题与libstdc ++。so.6在连接cuda的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
今天我遇到了一个问题,链接我编译的cuda的东西。
我有一个uptodate debian测试w / 2.6.32-3-amd64。
我一整天都在我的代码。不时编译。
没有问题。但是后一个小代码更改我得到以下错误:
gcc -o pa CUDA.o histogram256.o histogram64.o main .o -lrt -lm -lcudart -I。 -I / data / cuda / include -I / data / cuda / C / common / inc -L / data / cuda / lib64
/ usr / bin / ld:main.o:未定义引用符号'std: :basic_ifstream< char,std :: char_traits< char> > :: close()@@ GLIBCXX_3.4'
/ usr / bin / ld:note:'std :: basic_ifstream< char,std :: char_traits< char> > :: close()@@ GLIBCXX_3.4'在DSO /usr/lib64/libstdc++.so.6中定义,因此请尝试将其添加到链接器命令行
/usr/lib64/libstdc++.so.6 :无法读取符号:无效操作
collect2:ld返回1退出状态
代码返回但错误保留。
lib是应该在哪里。 (/ usr / lib64链接到/ usr / lib)
ldd /usr/lib/libstdc++.so.6
linux-vdso.so.1 => (0x00007fff31fff000)
libm.so.6 => /lib/libm.so.6(0x00007f15f625a000)
libc.so.6 => /lib/libc.so.6(0x00007f15f5ef9000)
/lib64/ld-linux-x86-64.so.2(0x00007f15f680d000)
libgcc_s.so.1 => /lib/libgcc_s.so.1(0x00007f15f5ce2000)
希望有人有一个好的建议。 >
解决方案
添加
usb / lib64 -lstdc ++
到我的makefile / commandlineparameters修复它。
today i encountered a problem with linking my compiled cuda stuff.
i have a uptodate debian testing w/ 2.6.32-3-amd64.
i worked all day on my code. compiling from time to time. had no problem. but then after a minor code change i got following error:
gcc -o pa CUDA.o histogram256.o histogram64.o main.o -lrt -lm -lcudart -I. -I/data/cuda/include -I/data/cuda/C/common/inc -L/data/cuda/lib64
/usr/bin/ld: main.o: undefined reference to symbol 'std::basic_ifstream<char, std::char_traits<char> >::close()@@GLIBCXX_3.4'
/usr/bin/ld: note: 'std::basic_ifstream<char, std::char_traits<char> >::close()@@GLIBCXX_3.4' is defined in DSO /usr/lib64/libstdc++.so.6 so try adding it to the linker command line
/usr/lib64/libstdc++.so.6: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
i changed the code back but the error stayed.
the lib is where it should be. (/usr/lib64 is linked to /usr/lib)
ldd /usr/lib/libstdc++.so.6
linux-vdso.so.1 => (0x00007fff31fff000)
libm.so.6 => /lib/libm.so.6 (0x00007f15f625a000)
libc.so.6 => /lib/libc.so.6 (0x00007f15f5ef9000)
/lib64/ld-linux-x86-64.so.2 (0x00007f15f680d000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f15f5ce2000)
hopefully someone has a good advice.
解决方案
adding
-L/usr/lib64 -lstdc++
to my makefile/commandlineparameters fixed it.
这篇关于链接器问题与libstdc ++。so.6在连接cuda的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文