Error: expected primary-expression before ‘>’ token

Hi,

Can someone help to fix my compiling issues? Thanks.

code structure:

a.cu:

__global__
void f(){

}

b.cuh:

/* I have a a.cuh declaring the f() function. I have a “__global__” before f() declaring. */
include “a.cuh”
template<typename T>
void g(){

/* T is not used in f */
f<<<grid, threads>>>();

}

As I included a.cuh in b.cuh and these files are compiled by NVCC, the compiling errors are weird for me.

Error hints:

error: expected primary-expression before ‘<’ token
error: expected primary-expression before ‘>’ token

I found some previous solutions posted by Robert Crovella

In all, just move the template into a .cu file rather than in a .cuh file.

Thank you, Robert Crovella!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.