Function not in current scope

Hi all,
I tried to use “polar” function (#included ) in a script, for example exp.cpp.

If I input

g++ exp.cpp
then everything goes fine.
But if I input
root exp.cpp
Error: Function polar(1.3,3.14) is not defined in current scope exp.cpp:11:
*** Interpreter error recovered ***

How to solve this? Thanks for any help or advise!


It works for me.

root [0] .x exp.C
root [1] 

where exp.C is:

#include <complex>

void exp() {
   cout << polar(1.3,3.14) << endl;

Hi couet,
Thanks but it still doesn’t work for me.
Is it relevant to version?

  •                                     *
  •    W E L C O M E  to  R O O T       *
  •                                     *
  • Version 5.14/00f 29 May 2007 *
  •                                     *
  • You are welcome to visit our Web site *
  •      [](            *
  •                                     *

FreeType Engine v2.1.9 used to render TrueType fonts.
Compiled on 30 May 2007 for linux with thread support.

CINT/ROOT C/C++ Interpreter version 5.16.16, November 24, 2006


Yes, may be it is worth trying a more recent version.