I’m getting undefined reference errors when I compile. I am doing a GPU implementation of an application that I have used before that is written in C. I integrated cuda functions into the source code but only in the file that includes the main function which is also called main.cu. The Makefile is straight forward but kind of long; so here’s the part of the file that is relevant to the device code:
…
all: main.o labeltree.o bbtsp.o inittree.o gen_tree.o binencode.o condense.o const_tree.o uf.o invdist.o neighborj.o circ_order.o read_input.o circular_ordering.o convert.o sorting_reversal_median.o all_sorting_reversals.o vertex_factory.o condense3.o inversion_median_alberto.o lists.o med_util.o greedy_median.o priority_stack.o correction.o hashtable.o specialinit.o growTree.o cheaptsp.o specialtsp.o randomBSD.o
nvcc -L/usr/local/cuda -lcuda -L…/…/CUDA/V2.2/lib -lcutil main.o labeltree.o bbtsp.o inittree.o gen_tree.o binencode.o condense.o const_tree.o uf.o invdist.o neighborj.o circ_order.o read_input.o circular_ordering.o convert.o sorting_reversal_median.o all_sorting_reversals.o vertex_factory.o condense3.o inversion_median_alberto.o lists.o med_util.o greedy_median.o priority_stack.o correction.o hashtable.o specialinit.o growTree.o cheaptsp.o specialtsp.o randomBSD.o -o grappa-gpu
…
main.o: main.cu labeltree.h bbtsp.h inittree.h gen_tree.h binencode.h structs.h condense.h const_tree.h uf.h invdist.h neighborj.h circ_order.h read_input.h circular_ordering.h
nvcc -I/usr/local/cuda -I…/…/CUDA/V2.2/common/inc main.cu -c -o main.o -DGPU=1
…
As I said before there is only device code in the “main.cu” file. You could probably ignore all the other file names but I wanted to give a complete picture of how i’m compiling and linking the “main” file.
Any suggestions on how to get the linker to recognoize the declerations in the other files?