Web lists-archives.com

Re: Monit Compilation Errors




On 2018-01-15, Kizito Porta Balanyà wrote:
> Hello all,
>
> I'm trying to compile the last version of MONIT and I get some errors that
> I can not solve.
>
> <command-line>:0:6: error: expected identifier or ‘(’ before numeric
> constant
> src/monit.h:581:19: note: in expansion of macro ‘unix’
>                  } unix;
>                    ^~~~

>From https://gcc.gnu.org/onlinedocs/cpp/System-specific-Predefined-Macros.html

"historically system-specific macros have had names with no special
prefix; for instance, it is common to find unix defined on Unix systems.
[...] When the -ansi option, or any -std option that requests strict
conformance, is given to the compiler, all the system-specific predefined
macros outside the reserved namespace are suppressed."


You can see the predefined macros with `cpp -dD /dev/null'.

$ cpp -dD /dev/null
# 1 "/dev/null"
# 1 "<built-in>"
[...]
#define __unix__ 1
#define __unix 1
#define __declspec(x) __attribute__((x))
#define __DECIMAL_BID_FORMAT__ 1
# 1 "<command-line>"
#define unix 1                     <-- this is your problem
# 1 "/dev/null"


With -ansi:

$ cpp -ansi -dD /dev/null
# 1 "/dev/null"
# 1 "<built-in>"
[...]
#define __unix__ 1
#define __unix 1
#define __declspec(x) __attribute__((x))
#define __DECIMAL_BID_FORMAT__ 1
# 1 "<command-line>"
# 1 "/dev/null"


$ cpp --version
cpp (GCC) 6.4.0


You can undefine the unix macro or rename the unix struct.

szgyg


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple