Using CUDA Library in Qt Project



  • Hello all,

    I'm trying to get a simple Qt Widget project to use a CUDA library that I've compiled. I've added the following to the .pro file:

    @LIBS += -L$$PWD/ -lCUDA_lib

    INCLUDEPATH += $$PWD/
    DEPENDPATH += $$PWD/@

    The library consists of the basic CUDA VS2012 template (just a kernel.cu file implementing array addition), but when I call the function to start this:

    @int a [5] = {1, 2, 3, 4, 5};
    int b [5] = {6, 7, 8, 9, 10};
    int c [5] = {};
    addWithCuda(c, a, b, 5);@

    I get a "C3861: 'addWithCuda': identifier not found" error.

    I assume I have to use a header file here, but I am unsure how. I have the .lib file copied to the Qt project's base directory, but should I instead reference the original in the .pro file?

    Any help would be greatly appreciated. Thanks.

    Phillip





  • Thanks for the links!

    I'd actually previously found both of those however (I'm doing this on Windows, so the second was more for me), and neither of those methods worked :-(. One mentioned to be sure to run qmake whenever you change the .pro file... I assume building the project in Qt Creator does this, or do I need to run qmake separately if I only change the .pro file?

    In any event, I do have a dual book Windows/Ubuntu set up, so maybe I'll have better luck if I try all of this on the Linux side. I'll give it a shot.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.