Important: Please read the Qt Code of Conduct -

CUDA incompatible with Qt?

  • Including qtcore.h in my .cu (CUDA) file generates several internal Qt compile errors like the following:

    c:\qt\4.8.0\include\qtcore../../src/corelib/global/qglobal.h(2152): error : more than one instance of overloaded function "swap" matches the argument list:
    2> function template "void swap(T &, T &)"
    2> function template "void std::swap(_Ty &, _Ty &)"
    2> argument types are: (QByteArray::Data *, QByteArray::Data *)
    2> detected during instantiation of "void qSwap(T &, T &) [with T=QByteArray::Data *]"
    2> c:\qt\4.8.0\include\qtcore../../src/corelib/tools/qbytearray.h(161): here

    As far as I now my code does not call swap, but I may be wrong.

    Any suggestions?

  • Moderators

    Hi, and welcome to the Qt Dev Net!

    [quote]As far as I now my code does not call swap[/quote]It looks like your code has using namespace std, which causes a name clash between std::swap() and the other swap(). Move your #include out of the std namespace.

    Other notes:

    • Qt 4.8.0 is extremely old. Consider upgrading to Qt 4.8.6 (or Qt 5.3.1, if this is a new project)
    • Including the whole of Qt Core may slow down your compilation. Instead of #include "qtcore.h", consider including the specific classes that you need.

Log in to reply