开发者

bool from a struct lead to "error: expression must have class type"

开发者 https://www.devze.com 2023-01-21 04:40 出处:网络
I have a struct defined as struct sData{ idx * id; int * stime; bool * result; unsigned int N; }; Then the code that uses it in

I have a struct defined as

struct sData{ 
idx * id; 
int * stime; 
bool * result;  
unsigned int N;
};

Then the code that uses it in

numeric compute(numeric e, sData swabs){
  numeric cache=0.0;
  int sid=0;
  while(sid<swabs.N){
    if(swab.result[sid]) 
      cache += log(e);
    else cache += log(1.0-e);
    sid += 1;
  }
  return cache;
}

but when compiling I get the error.

paug_cuda.cu(602): error: expression must have class type

What is this supposed to mean. w开发者_开发问答hat class type? I'm using a bool in a logical expression. what else could there be to this. What am I missing?


swab -> swabs :)

The error means that you wrote something like X.Y and X is not an instance of a class/struct.

0

精彩评论

暂无评论...
验证码 换一张
取 消