Error using __device__ __host__ error C2146: syntax error : missing ';'

I am receiving my errors in .cu and .h files that state: error C2146: syntax error : missing ‘;’ before identifier ‘host

All of these lines have device host. Here is an example of once such line that resides within a class:

__device__ __host__ vector<double* >& KaiPreSampledDelay(VALUE v) { return _KaiPreSampledDelay[v]; }

What am I doing wrong? Thanks for any help.

Why device and host are used at the same time? I think you should use only one of them.

Or you should better to carefully read the programming guide for device and host and so on.

It is completely valid to use device and host at the same time. This allows to use a function in host and device coding.

Do you compile using nvcc? Otherwise you should include <cuda_runtime.h>.

1 Like