Author Topic: Generic function  (Read 6258 times)

Offline RBendo

  • Single posting newcomer
  • *
  • Posts: 7
Generic function
« on: September 02, 2009, 08:08:14 pm »
i'm not english, so i don't speak english very well, i've installed Code::Blocks, and i wrote a small application which use
the functionality of the generic function:

template <class T> double IDENT () { ... }

But, when i compile the source code, the compiler don't recognize the word template.
Is possible that code::blocks don't recognize template functionality? How do I to introduce this in code::blocks


Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Generic function
« Reply #1 on: September 02, 2009, 08:29:03 pm »
Code__BLocks is the IDE and not the compiler.

Which compiler, OS and version of C::B dou you use ?

What's the exact error-message you get ?

If it's something like
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘<’ token
you might try to use the template keyword in a c- and not c++-file.

Be aware, that a file with the ending "c" is treated as c-file. If that's the case, rename your file to cpp close C::B and restart it.