I am trying to modify a Makefile to include an externally compiled object, but am getting an "undefined reference" error. This it the first time I've dealt with Makefiles - please be gentle.
What I've done so far:
- Modified main.c to include a new header file, cudacrack.h
- Added a call to runCudaImplementation() to main.c, which is defined in cudacrack.h
- Modified the Makefile.in file to include cudacrack.o as an object dependency
- Modified Makefile.in to include cudacrack.h as a source file
- make clean
- Compiled cudacrack.c with: g++ -c cudacrack.c -o cudacrack.o
- ./configure
- make --debug==verbose
I get this error during linking:
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
Note: At this point the "cuda" file name only contain basic C methods. Later I will compile this part with nvcc. I explain a little more on my other question that led me here: 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'.
What needs to happen for make to link the main program with the cudacrack.o dependency?