My SHA256 cuda code not compiling, don't know why

sha256.cu

#define uint32_t unsigned int
__constant__ const uint32_t H[]={0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
#define rol(x,n) ((x << n) | (x >> (32-n)))
#define ror(x,n) ((x >> n) | (x << (32-n)))
#define Ch(x,y,z) ((x & y) ^ ( (~x) & z))
#define Maj(x,y,z) ((x & y) ^ (x & z) ^ (y & z))
#define Sigma0(x) ((ror(x,2))  ^ (ror(x,13)) ^ (ror(x,22)))
#define Sigma1(x) ((ror(x,6))  ^ (ror(x,11)) ^ (ror(x,25)))
#define sigma0(x) ((ror(x,7))  ^ (ror(x,18)) ^(x>>3))
#define sigma1(x) ((ror(x,17)) ^ (ror(x,19)) ^(x>>10))


/* 
=============================================================================================

Code for GPU/CPU

=============================================================================================
*/
__host__ __device__ 
void sha256(std::basic_string msg , unsigned char* result)
{
    const uint32_t k[]={
        0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
        0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
        0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
        0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
        0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
        0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
        0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
        0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2};
       uint32_t w[64]={0};

       uint32_t cand[16];
       memset(cand,0,16*sizeof(uint32_t));

       //conversion to uint32 and padding
	  uint32_t dl=msg.length,j;
	  for(j=0;j<dl;j++){
	      uint32_t tmp=0;
	      tmp |= (((uint32_t) msg.value[j]) << ((3-(j & 0x3)) << 3));
	      cand[j/4]|=tmp;
	    }
	  cand[j / 4] |= (((uint32_t) 0x80) << ((3-(j & 0x3)) << 3));
      cand[15]=0x00000000|(dl*8);
      
      #pragma unroll 64
	  for(uint32_t j=0;j<64;j++){
	    if(j<16) w[j]=cand[j];
	  else w[j]=sigma1(w[j-2])+w[j-7]+sigma0(w[j-15])+w[j-16];
	  }

	  uint32_t a=H[0];uint32_t b=H[1];uint32_t c=H[2];uint32_t d=H[3];
	  uint32_t e=H[4];uint32_t f=H[5];uint32_t g=H[6];uint32_t h=H[7];
	  #pragma unroll 64
	  for(uint32_t j=0;j<64;j++){
	   uint32_t t1=h+Sigma1(e)+Ch(e,f,g)+k[j]+w[j];
	   uint32_t t2=Sigma0(a)+Maj(a,b,c);
	   h=g;g=f;f=e;e=d+t1;d=c;c=b;b=a;a=t1+t2;
	  }

        result[0] = a+H[0] >> 24;
        result[1] = a+H[0] >> 16;
        result[2] = a+H[0] >>  8;
        result[3] = a+H[0];
        result[4] = b+H[1] >> 24;
        result[5] = b+H[1] >> 16;
        result[6] = b+H[1] >>  8;
        result[7] = b+H[1];
        result[8] = c+H[2] >> 24;
        result[9] = c+H[2] >> 16;
        result[10] = c+H[2] >> 8;
        result[11] = c+H[2];
        result[12] = d+H[3] >> 24;
        result[13] = d+H[3] >> 16;
        result[14] = d+H[3] >>  8;
        result[15] = d+H[3];
        result[16] = e+H[4] >> 24;
        result[17] = e+H[4] >> 16;
        result[18] = e+H[4] >>  8;
        result[19] = e+H[4];
        result[20] = f+H[5] >> 24;
        result[21] = f+H[5] >> 16;
        result[22] = f+H[5] >>  8;
        result[23] = f+H[5];
        result[24] = g+H[6] >> 24;
        result[25] = g+H[6] >> 16;
        result[26] = g+H[6] >>  8;
        result[27] = g+H[6];
        result[28] = h+H[7] >> 24;
        result[29] = h+H[7] >> 16;
        result[30] = h+H[7] >>  8;
        result[31] = h+H[7];

};

nvcc sha256.cu

sha256.cu(15): error: argument list for class template “std::__cxx11::basic_string” is missing

sha256.cu(14): error: attribute “host” does not apply here

sha256.cu(15): error: incomplete type is not allowed

sha256.cu(15): error: expected a “)”

sha256.cu(16): error: expected a “;”

sha256.cu(38): warning: parsing restarts here after previous syntax error

sha256.cu(39): error: this declaration has no storage class or type specifier

sha256.cu(39): error: identifier “dl” is undefined

sha256.cu(42): error: expected a declaration

sha256.cu(47): warning: parsing restarts here after previous syntax error

sha256.cu(50): error: expected a declaration

sha256.cu(56): warning: parsing restarts here after previous syntax error

sha256.cu(57): error: this declaration has no storage class or type specifier

sha256.cu(57): error: identifier “a” is undefined

sha256.cu(58): error: this declaration has no storage class or type specifier

sha256.cu(58): error: variable “result” has already been defined

sha256.cu(59): error: this declaration has no storage class or type specifier

sha256.cu(59): error: variable “result” has already been defined

sha256.cu(60): error: this declaration has no storage class or type specifier

sha256.cu(60): error: variable “result” has already been defined

sha256.cu(60): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [4]”

sha256.cu(61): error: this declaration has no storage class or type specifier

sha256.cu(61): error: variable “result” has already been defined

sha256.cu(61): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [5]”

sha256.cu(62): error: this declaration has no storage class or type specifier

sha256.cu(62): error: variable “result” has already been defined

sha256.cu(62): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [6]”

sha256.cu(63): error: this declaration has no storage class or type specifier

sha256.cu(63): error: variable “result” has already been defined

sha256.cu(63): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [7]”

sha256.cu(64): error: this declaration has no storage class or type specifier

sha256.cu(64): error: variable “result” has already been defined

sha256.cu(64): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [8]”

sha256.cu(65): error: this declaration has no storage class or type specifier

sha256.cu(65): error: variable “result” has already been defined

sha256.cu(65): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [9]”

sha256.cu(66): error: this declaration has no storage class or type specifier

sha256.cu(66): error: variable “result” has already been defined

sha256.cu(66): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [10]”

sha256.cu(67): error: this declaration has no storage class or type specifier

sha256.cu(67): error: variable “result” has already been defined

sha256.cu(67): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [11]”

sha256.cu(68): error: this declaration has no storage class or type specifier

sha256.cu(68): error: variable “result” has already been defined

sha256.cu(68): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [12]”

sha256.cu(69): error: this declaration has no storage class or type specifier

sha256.cu(69): error: variable “result” has already been defined

sha256.cu(69): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [13]”

sha256.cu(70): error: this declaration has no storage class or type specifier

sha256.cu(70): error: variable “result” has already been defined

sha256.cu(70): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [14]”

sha256.cu(71): error: this declaration has no storage class or type specifier

sha256.cu(71): error: variable “result” has already been defined

sha256.cu(71): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [15]”

sha256.cu(72): error: this declaration has no storage class or type specifier

sha256.cu(72): error: variable “result” has already been defined

sha256.cu(72): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [16]”

sha256.cu(73): error: this declaration has no storage class or type specifier

sha256.cu(73): error: variable “result” has already been defined

sha256.cu(73): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [17]”

sha256.cu(74): error: this declaration has no storage class or type specifier

sha256.cu(74): error: variable “result” has already been defined

sha256.cu(74): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [18]”

sha256.cu(75): error: this declaration has no storage class or type specifier

sha256.cu(75): error: variable “result” has already been defined

sha256.cu(75): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [19]”

sha256.cu(76): error: this declaration has no storage class or type specifier

sha256.cu(76): error: variable “result” has already been defined

sha256.cu(76): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [20]”

sha256.cu(77): error: this declaration has no storage class or type specifier

sha256.cu(77): error: variable “result” has already been defined

sha256.cu(77): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [21]”

sha256.cu(78): error: this declaration has no storage class or type specifier

sha256.cu(78): error: variable “result” has already been defined

sha256.cu(78): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [22]”

sha256.cu(79): error: this declaration has no storage class or type specifier

sha256.cu(79): error: variable “result” has already been defined

sha256.cu(79): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [23]”

sha256.cu(80): error: this declaration has no storage class or type specifier

sha256.cu(80): error: variable “result” has already been defined

sha256.cu(80): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [24]”

sha256.cu(81): error: this declaration has no storage class or type specifier

sha256.cu(81): error: variable “result” has already been defined

sha256.cu(81): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [25]”

sha256.cu(82): error: this declaration has no storage class or type specifier

sha256.cu(82): error: variable “result” has already been defined

sha256.cu(82): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [26]”

sha256.cu(83): error: this declaration has no storage class or type specifier

sha256.cu(83): error: variable “result” has already been defined

sha256.cu(83): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [27]”

sha256.cu(84): error: this declaration has no storage class or type specifier

sha256.cu(84): error: variable “result” has already been defined

sha256.cu(84): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [28]”

sha256.cu(85): error: this declaration has no storage class or type specifier

sha256.cu(85): error: variable “result” has already been defined

sha256.cu(85): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [29]”

sha256.cu(86): error: this declaration has no storage class or type specifier

sha256.cu(86): error: variable “result” has already been defined

sha256.cu(86): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [30]”

sha256.cu(87): error: this declaration has no storage class or type specifier

sha256.cu(87): error: variable “result” has already been defined

sha256.cu(87): error: a value of type “unsigned int” cannot be used to initialize an entity of type “int [31]”

sha256.cu(89): error: expected a declaration

Error limit reached.
100 errors detected in the compilation of “/tmp/tmpxft_00001e69_00000000-8_sha256.cpp1.ii”.
Compilation terminated.

It’s my first time writing cuda programs, and the errors just confuse me so bad…

problem solved