Compiling a C++ based project that is utilizing an f2c.h header file, within the header file is a macro definition for min and max as follows...
#ifndef min
#define min(a,b) ((a) <= (b) ? (a) : (b))
#endif
#ifndef max
#define max(a,b) ((a) >= (b) ? (a) : (b))
#endif
This code had no issues when I was compiling and running on windows with Microsoft visual studios. Now I am trying to compile and run on LINUX with the g++ compiler, and I am getting the following error messages...
In file included from tsdriver.cpp:68:0:
/usr/include/c++/6/bits/fstream.tcc: In member function ‘virtual
std::basic_filebuf<_CharT, _Traits>::int_type std::basic_filebuf<_CharT,
_Traits>::underflow()’:
f2c.h:155:18: error: expected unqualified-id before ‘(’ token
#define min(a,b) ((a) <= (b) ? (a) : (b))
Now, it's only giving me the error messages for the min macro, but I believe that this is due to the compiler error being such that compilation must then be terminated.
I have done some testing and found that min/max can be called from a small test.cpp program without any extra includes, so initially thinking the error was coming from a redefinition, but that shouldn't matter since #ifndef would prevent this?
I'm not sure how to remedy this, and I'm still adjusting to a LINUX development environment. Any help is appreciated.
Thanks.