我正在尝试修改Makefile以包含外部编译的对象,但是收到“未定义的引用”错误。这是我第一次处理Makefiles - 请保持温和。
到目前为止我做了什么:
我在链接期间遇到此错误:
g++ -L/usr/local/cuda/lib64/ -lcuda -lcudart -g -O2 -funroll-loops -O3 -o fcrackzip main.o crack.o cudacrack.o
main.o: In function `main':
$HOME/fcrackzip/fcrackzip-1.0/main.c:367: undefined reference to `runCudaImplementation'
collect2: ld returned 1 exit status
注意:此时“cuda”文件名只包含基本的C方法。稍后我将用nvcc编译这个部分。我在我的另一个问题上解释了一点:Building GPL C program with CUDA module
Some debug info from make:
Considering target file `cudacrack.h'.
Finished prerequisites of target file `cudacrack.h'.
No commands for `cudacrack.h' and no prerequisites actually changed.
No need to remake target `cudacrack.h'.
..later..
Considering target file `cudacrack.o'.
Considering target file `cudacrack.c'.
Finished prerequisites of target file `cudacrack.c'.
No need to remake target `cudacrack.c'.
Finished prerequisites of target file `cudacrack.o'.
Prerequisite `cudacrack.c' is older than target `cudacrack.o'.
No need to remake target `cudacrack.o'.
将主程序与cudacrack.o依赖关系链接起来需要做些什么?
答案 0 :(得分:1)
您是否检查了runCudaImplementation
中是否实际定义了符号cudacrack.o
?也许这个名字被破坏了,因为你使用g ++来编译它,而不是gcc。