I'm trying to link these object files with the command:
g++ NT_FFT_Decomp.o T_FFT_Decomp.o SNT_FFT_Comp.o ST_FFT_Comp.o VNT_FFT_Comp.o VT_FFT_Comp.o CUDA_FFT_Comp.o Globals.o main.o \
-L/media/wiso/Programs/Setups/CUDA/include -lcuda -lcudart -lpthread -o DevicesTest
/media/wiso/Programs/Setups/CUDA
is my cuda installation directory. and my LD_LIBRARY_PATH is like this :
Irrelevant:/media/wiso/Programs/Setups/CUDA/lib64:/media/wiso/Programs/Setups/CUDA/lib:Irrelevant
the command gives this error message:
/usr/bin/ld: cannot find -lcuda
/usr/bin/ld: cannot find -lcudart
removing -lcuda and -lcudart generates undefined reference to cuda functions errors.
how can I link this properly ??
You need to add the compiler switch:
-L/usr/local/cuda/lib64
or something similar, to tell g++ where to find the -lcuda
and -lcudart
libraries.
In your case, the line is probably:
-L/media/wiso/Programs/Setups/CUDA/lib64
instead of the existing statement that you have. (change include
to lib64
or possibly lib
)
Again, LD_LIBRARY_PATH
has nothing to do with compiling and linking.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With