Question

I have pretty much the same problem as discussed in this question:

CURAND Library - Compiling Error - Undefined reference to functions

Namely, after having included cuda.h, curand.h and curand_kernel libraries, using

    curandGenerator_t gen;

and

    curandCreateGenerator(&gen, CURAND_RNG_PSEUDO_DEFAULT);

gives me the following error:

    undefined reference to `curandCreateGenerator'

I am aware that this is a duplicate, but I really don't understand what should I do.

I'm using Nsight Eclipse on Ubuntu and I tried adding "-lcurand " to

Project Properties -> Build -> Settings -> Tool Settings -> NVCC Compiler -> Command

and I tried changing it to "nvcc -o RNG7 RNG7.cu -lcurand -Xlinker=-rpath,/usr/local/cuda/lib" as suggested, but nothing seems to work.

I'm a real newbie here, so a little detailed help would be appreciated, along with some reasons behind it, I prefer understanding things to quick fixes!

Was it helpful?

Solution

I got it, it was a very easy fix!

You need to go to:

Project Properties -> Build -> Settings -> Tool Settings -> NVCC Linker -> Libraries

and simply add a new library called "curand".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top