Namespace error with is_ex_the_function
Hello, The following program #include <iostream> #include <ginac/ginac.h> int main() { GiNaC::symbol x("x"); std::cout << GiNaC::is_ex_the_function(x, GiNaC::sin) << std::endl; } gives me a compilation error: bug.cpp:6:24: error: unexpected parenthesis after '::' std::cout << GiNaC::is_ex_the_function(x, GiNaC::sin) << std::endl; ^ /usr/local/include/ginac/function.h:767:43: note: expanded from macro 'is_ex_the_function' #define is_ex_the_function(OBJ, FUNCNAME) (GiNaC::is_the_function<FUNCNAME##_SERIAL>(OBJ)) ^ bug.cpp:6:17: error: no member named 'GiNaC' in namespace 'GiNaC'; did you mean simply 'GiNaC'? std::cout << GiNaC::is_ex_the_function(x, GiNaC::sin) << std::endl; ^ /usr/local/include/ginac/parser.h:31:11: note: 'GiNaC' declared here namespace GiNaC { ^ bug.cpp:6:24: error: expected ';' after expression std::cout << GiNaC::is_ex_the_function(x, GiNaC::sin) << std::endl; ^ /usr/local/include/ginac/function.h:767:90: note: expanded from macro 'is_ex_the_function' #define is_ex_the_function(OBJ, FUNCNAME) (GiNaC::is_the_function<FUNCNAME##_SERIAL>(OBJ)) ^ bug.cpp:6:24: error: expected expression /usr/local/include/ginac/function.h:767:90: note: expanded from macro 'is_ex_the_function' #define is_ex_the_function(OBJ, FUNCNAME) (GiNaC::is_the_function<FUNCNAME##_SERIAL>(OBJ)) ^ 4 errors generated. This is with GiNaC 1.6.5 on Mac OS 10.11, with compiler Apple version 7.0.0. It seems there is an issue with the namespace. Removing `GiNaC::` from `is_ex_the_function` compiles fine. Anyone else have this? Cheers, Jacob Garber
Hi, On Mon, Oct 19, 2015 at 12:12 AM, Jacob Garber <jgarber1@ualberta.ca> wrote:
std::cout << GiNaC::is_ex_the_function(x, GiNaC::sin) << std::endl;
is_ex_the_function is a macro, and the preprocessor has no idea about C++ namespaces.
Removing `GiNaC::` from `is_ex_the_function` compiles fine.
Which is the right way to use the `is_ex_the_function' macro. Best regards, Alexey
participants (2)
-
Alexei Sheplyakov
-
Jacob Garber