Okay, I'm getting errors when I try to compile my program. I think I know what the problem is, but I'm not sure what is the best way to fix it. The program is using the pari/gp number theory library. Problem is, when I include both pari.h and algorithm.h from STL, I get errors:
make -k
g++ -c -I. -I/opt/local/include -I/usr/local/include -g algebraic.cc
g++ -c -I. -I/opt/local/include -I/usr/local/include -g hello.cc
In file included from /usr/include/c++/4.3/bits/stl_algo.h:66,
from /usr/include/c++/4.3/algorithm:67,
from stableform.h:10,
from hello.cc:6:
/usr/include/c++/4.3/bits/algorithmfwd.h:248:41: error: macro "max" passed 3 arguments, but takes just 2
/usr/include/c++/4.3/bits/algorithmfwd.h:259:41: error: macro "min" passed 3 arguments, but takes just 2
My guess is pari has already defined max, and this is conflicting with algorithm. Does this sound correct, and is there a smart C++ way to get around this without messing around with the libraries themselves? I already tried switching the order which they were included since this helped similar problems in the past, but that didn't work. Anyway it is a hack and there must be a better solution. The program also compiles and works as is on a different computer...
Thanks for the reply. I haven't tried it yet, but quick question: Does it sound like a correct statement of the problem? The pari library is defining the functions max and min in the global namespace, which is then a problem when the STL library tries to uses these names for its internal functions. If this is the problem, then is there a way to get the pari library to define stuff only in its own namespace? I tried