Unsolved Undefined reference and no rule for target when including CUDA in a Qt Project
-
@patelvrajn You should fix your LIBS like:
LIBS += -LPATH_TO_LIBS_DIR -lcudart -lcuda
-
I have updated the drive link with the edits made to the file, jsulm_ver.pro is the latest file.
@dheerendra I checked the project file and some of the included files, I could not find a path in a format used in other platforms.
@jsulm I have fixed the LIBS as you suggested (as seen in the juslm_ver.pro) however, it still outputs the following error:
"Undefined reference error to an existing function inside of cudaflow.cu named gpuFlow(…)"
-
Undefined reference error to an existing function inside of cudaflow.cu named gpuFlow(…)"
So you need to find out in which library this function resides and then compare with your linker command line (in compile output), if you are actually linking to this library.
Should be easy to fix.
-
@aha_1980 This was one of the solutions we thought of before with no success however, I did reattempt this solution. This time I ran a 'ls' command of the 'opt/cuda/lib64' directory and listed all the libraries in a text file, cuda_libs.txt (uploaded in the google drive link). Afterwards, I included all of the libraries in the project file, aha1980_ver.pro (uploaded in the google drive link), and ran it (clean, qmake, build & run) and got the same error.
By same error I am referring to:
"Undefined reference error to an existing function inside of cudaflow.cu named gpuFlow(…)"
-
Hi,
How did you declare these functions ?
-
The following is the declaration of the function gpuFlow in cudaflow.cu that is referenced by the error:
void gpuFlow(int a, int b, float *c, float *d, float *e, float *f, float *g, float *h, float *i, float *&j, float *&k, int l, int m, float o)
-
See if some defines are missing to say which library to use. Do you see method defined in header files ? That may give some hint on any export defines to best used.
-
@dheerendra I don't see any definitions missing. I do see the method declared but not defined in the header file. It is defined in the cudaflow.cu file. I also removed all the code from the gpuFlow function and left the function definition empty but the error is still the same (I see this as odd considering if we were missing libraries that were essential to the function call then wouldn't this still work?).
However, I did notice something that I didn't notice before which was a message from NVBLAS telling us that it was missing a path to the CPU Blas library. I fixed this issue by creating a nvblas config file (which was missing, I also uploaded the one I created to the drive link) but it not seem to change anything.
-
Method missing can happen only if
- Method implementation missing.
- Compiler missmatch
- 64/32 bit mismatch
- Some dependent libraries are misssing
- Library expects you to do some defines like #define CUDA_STATIC 1
These are hints for you to look at the issue.
-
We are still looking into these listed causes, we will post and share the result of our findings if anything comes about.