cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, just started with TrueStudio. Trying to code a class with a template pattern results in error: template <class TYPE, int SIZE> class { ... }; Error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token Any help welcome...

UJuer.1
Associate
 
3 REPLIES 3
TDK
Guru

Is your code in C or C++? Ensure the compiler sees it as C++.

If you feel a post has answered your question, please click "Accept as Solution".
UJuer.1
Associate

A class without a template pattern makes no problem, so it must be C++. Only a template <whatever> has a problem.

TDK
Guru

I'm aware you're trying to write C++ code. But if the file is named "something.c", the compiler will treat it as a C file.

If I use template within a C file, I get the exact error you've described:

...\printf.c:38:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
 template <class T>
          ^
mingw32-make.exe[3]: ***

If you feel a post has answered your question, please click "Accept as Solution".