Cannot find -lcuda when binding with g ++

I am trying to link these object files to a 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 looks like this:

 Irrelevant:/media/wiso/Programs/Setups/CUDA/lib64:/media/wiso/Programs/Setups/CUDA/lib:Irrelevant 

the command produces this error message:

 /usr/bin/ld: cannot find -lcuda /usr/bin/ld: cannot find -lcudart 

removing -lcuda and -lcudart generates an undefined link to cuda function errors. A.

how can i tie this right ??

+4
source share
2 answers

You need to add a compiler:

 -L/usr/local/cuda/lib64 

or something similar to tell g ++ where to find the -lcuda and -lcudart .

In your case, the line is probably the following:

 -L/media/wiso/Programs/Setups/CUDA/lib64 

instead of the existing operator that you have. (change include to lib64 or possibly lib )

Again, LD_LIBRARY_PATH has nothing to do with compilation and linking.

+6
source

-L/media/wiso/Programs/Setups/CUDA/include // WRONG : "-L" for libraries ... but "/ include" is usually for headers

SUGGESTED CHANGES: -L/media/wiso/Programs/Setups/CUDA/lib64

FULL LINE LINE:

 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/lib64 -lcuda -lcudart -lpthread \ -o DevicesTest 
+2
source

Source: https://habr.com/ru/post/1480600/


All Articles