Joseph Stateson
Joseph Stateson

Reputation: 61

Defining uint="unsigned int" is not being applied as I expected using nvcc in Visual Studio

Sorry, stuck with VS2013 but I don't think that is a problem. The same code compiles correctly on linux. I assume I need to define uint rather than edit 100+ lines of code. I am getting "error : explicit type is missing ("int" assumed)" on first line of below code

__device__ uint inline get_smid(void)
{
  uint ret;
  asm("mov.u32 %0, %%smid ;" : "=r"(ret) );
  return ret; 
}

At the property for the app there is only CUDA => Host => Preprocessor Definitions I put in

WIN32;uint="unsigned int"

This seemed to fix the "assumed int" but now I am getting "error : expected a declaration" Replacing uint with unsigned int in the source will compile without error. There is a lot of uint and this breaks with the linux build. Is more required besides 'uint="unsigned int"'? Maybe a switch to cause the NVCC to accept the uint and not give an error?

Just discovered a lot of ushort and I am guessing the same problem. Also, looking at the Linux build, the source were compiled with gcc but the link was done with nvcc so there is a difference.

====sample CUDA has ushort==== i must have not set up the include correctly as these variables are probably ok to use.

Upvotes: 0

Views: 748

Answers (1)

Joseph Stateson
Joseph Stateson

Reputation: 61

I gave up trying to define uint or ushort as the sample CUDA programs had

typedef unsigned int uint;
typedef unsigned short ushort;

so I just put those in each cu file that needed it.

Upvotes: 1

Related Questions