当我取消选中NetBeans IDE中的启用依赖关系检查(请参阅this issue)时,IDE现在使用nvcc并将我的.cu编译为.o但它根本不进行链接:
“/ usr / bin / make”-f nbproject / Makefile-Debug.mk QMAKE = SUBPROJECTS = .build-conf make1:输入目录/ me / NetBeansProjects / my_CUDA_1'“/ usr / bin / make”-f nbproject / Makefile -Debug.mk dist / Debug / GNU-Linux-x86 / libmy_cuda_1.a make [2]:输入目录/ me / NetBeansProjects / my_CUDA_1'mkdir -p build / Debug / GNU-Linux-x86 / usr / local / cuda- 5.0 / bin / nvcc -c -g -I / usr / local / cuda-5.0 / include -I / usr / local / cuda-5.0 / samples / common / inc -o build / Debug / GNU-Linux-x86 / cudaMain .o cudaMain.cu mkdir -p dist / Debug / GNU-Linux-x86 rm -f dist / Debug / GNU-Linux-x86 / libmy_cuda_1.a ar -rv dist / Debug / GNU-Linux-x86 / libmy_cuda_1.a build /Debug/GNU-Linux-x86/cudaMain.o ar:创建dist / Debug / GNU-Linux-x86 / libmy_cuda_1.aa - build / Debug / GNU-Linux-x86 / cudaMain.o ranlib dist / Debug / GNU-Linux -x86 / libmy_cuda_1.a make [2]:离开目录/ me / NetBeansProjects / my_CUDA_1'make [1]:离开目录/ me / NetBeansProjects / my_CUDA_1'BUILD SUCCESSFUL(总时间:2s)
我可以从终端链接:
comp @ comp:#ls cudaMain.o comp @ comp:#g -m64 -o cudaMain cudaMain.o -L / usr / local / cuda-5.0 / lib64 -lcudart comp @ comp:# . / cudaMain comp @ comp: /我/的NetBeansProjects / my_CUDA_1 /编译/调试/ GNU Linux的86#
我认为这与以下事实有关:它不检查make依赖(?)在IDE中检查/取消选中/删除/添加/更改以启用链接的内容?我不知道为什么,但在Projects-> Properties中没有与链接相关的选项 .
编辑:
此时我解决了要安装的所有问题(使用Soroosh帮助,再次感谢)Ubuntu 12.10上的CUDA-5.0(并使用"NVIDIA binary Xorg driver, kernel module and VDPAU library from nvidia-current"驱动程序 - 只有这给了我额外的图形/分辨率)并使用Netbeans ALL示例项目进行编译并编译和运行我自己的 . if anyone has any problems, please ask
1 回答
我在配置类型之前更改为静态库,这是错误的:应该是应用程序,然后链接是可能的 . 我必须将Ide中的Run命令从调试位置更改为:
并使用GNU工具集合 . 现在没关系 . 它构建.o然后链接libcudart.so来创建可执行文件: