Getting a ONE SINGLE project to compile with QtCreator under Windows 7 64-bit

Hello guys,

I know this question may not be that original, but I’ve been working more than 20 hours on getting a CUDA program to compile with QtCreator under Windows 7, but no use. I eventually got the program called Cuda-Z, which was made with QtCreator, and I tried to compile it, hoping that I could take the qmake script from it, but doesn’t work as well.

Could someone please tell me why Cuda-Z doesn’t compile on Qt?

Please check it at

http://cuda-z.sourceforge.net/

I could compile a program on Visual Studio 2010. But I don’t want to use Visual Studio, since it’s not Cross-platform. The tutorials for VS2010 are pretty straight forward.

I can’t compile any program on command-line. I have a simple program taken from the book “CUDA application design and development”, from which I’m planning to learn CUDA:

//seqCuda.cu

#include <iostream>

using namespace std;

#include <thrust/reduce.h>

#include <thrust/sequence.h>

#include <thrust/host_vector.h>

#include <thrust/device_vector.h>

int main()

{

  const int N=50000;

// task 1: create the array

  thrust::device_vector<int> a(N);

// task 2: fill the array

  thrust::sequence(a.begin(), a.end(), 0);

// task 3: calculate the sum of the array

  int sumA= thrust::reduce(a.begin(),a.end(), 0);

// task 4: calculate the sum of 0 .. N-1

  int sumCheck=0;

  for(int i=0; i < N; i++) sumCheck += i;

// task 5: check the results agree

  if(sumA == sumCheck) cout << "Test Succeeded!" << endl;

  else { cerr << "Test FAILED!" << endl; return(1);}

return(0);

}

And when I compile it with the command:

nvcc seqCuda.cu -o seqCuda

I get errors that type size_t is redeclared.

I tried using FindCUDA.cmake, but that was a failure as well. I haven’t done that before, and it doesn’t work.

I need someone experienced to share their experience with me. I’m really tired of reading and trying uselessly. I went to every website and tested every code I found with every permutation of every line with every directory I have as absolute directories and even from PATH and it still doesn’t work. For every method there’s an error or a problem.

Thank you for any efforts.

Hello,
I’m an experienced CUDA programmer, but I’m just starting to use Qt and QtCreator so I’ll try my best to help you. Also I’m using linux so I don’t know how CUDA is installed on windows.
I really advice you to have a look at this website: Qt Creator + CUDA + Linux – cudaspace
It’s for linux, but it explains how to set up QtCreator to compile your CUDA code.
Basically, in your .pro file, you have to define an extra compiler configuration which explain to QtCreator how to compile your CUDA code and then link it to the rest of the code.
I hope this will help you.
Good luck.

I also had spend several days to compile cuda in QT. I tried almost all the solution found by google. But, finally, I failed. External Image

So now if you still want to us qt, I think the best way is to wrap and compile cuda code into a dll(use vs or command line), and use that dll in qt.

Make a lib or dll in Visual studio. Link the lib when you compile the project in QT.

Hello,

you should first check your CUDA installation. The Thrust example you posted compiles and works as expected for me. So, It may be an issue related with your CUDA installation.

Did you tried the examples of the CUDA SDK?.

In order to help you, post your Operating System, graphic device, nvidia driver version you installed and version of CUDA.

Regards,
Pablo.

Dear Wanderine,

My configuration is CUDA 5.5, Visual Studio 2012 Professional, Windows 7 (64-bit)
I made DLL and LIB in Visual Stduio 2012 for CUDA. When I try to link the LIB in QT project, using MinGW; I get undefined reference errors for my CUDA calls?
Could you please help me in that?