Topic
  • No replies
SystemAdmin
SystemAdmin
196 Posts

Pinned topic conflict with xlC using the local variable "hz"

‏2010-08-02T12:33:13Z |

Hi,
I have a problem when compiling
with xlC a c++ file containing the local variable hz which has already been predefined as internal macro in
the file system / usr / include / sys / m_param.h (error message: "1540-0063 (S) The text "100" is unexpected. ").
-D or -U options doesn't work at the command line ( error message: '/usr/include/sys/m_param.h', line 58.9: 1540-0848 (S) The macro name 'hz' is already defined with a different definition.) and I would not have to use "#undef hz" or #undef _ALL_SOURCE in the c++ file for example.

Regards,
Updated on 2010-10-07T12:26:57Z at 2010-10-07T12:26:57Z by rdh2010
  • SystemAdmin
    SystemAdmin
    196 Posts

    Re: conflict with xlC using the local variable "hz"

    ‏2010-08-03T11:35:13Z  
    Precision: on aix 5.3
  • SystemAdmin
    SystemAdmin
    196 Posts

    Re: conflict with xlC using the local variable "hz"

    ‏2010-09-23T02:14:01Z  
    Precision: on aix 5.3
    I think you have two alternatives to address this:

    1. Add either -D_ANSI_C_SOURCE or -D_POSIX_SOURCE to your command line. That will cause the compilers not to define these symbols. If your program conforms to either of these standards this is likely the way to go.

    2. Comment out the #define hz on <sys/m_param.h>. If you're not allowed to change the system headers, you can create your own copy of this file, on a directory of form /path/sys/m_param.h and then redirect the compiler to use it by adding -I/path to your command line.
  • rdh2010
    rdh2010
    2 Posts

    Re: conflict with xlC using the local variable "hz"

    ‏2010-09-27T12:36:01Z  
    I think you have two alternatives to address this:

    1. Add either -D_ANSI_C_SOURCE or -D_POSIX_SOURCE to your command line. That will cause the compilers not to define these symbols. If your program conforms to either of these standards this is likely the way to go.

    2. Comment out the #define hz on <sys/m_param.h>. If you're not allowed to change the system headers, you can create your own copy of this file, on a directory of form /path/sys/m_param.h and then redirect the compiler to use it by adding -I/path to your command line.
    Thank you for your response.
    As I am not allowed to modify system headers (for portability reasons), I will try the first one.
  • rdh2010
    rdh2010
    2 Posts

    Re: conflict with xlC using the local variable "hz"

    ‏2010-10-07T12:26:57Z  
    I think you have two alternatives to address this:

    1. Add either -D_ANSI_C_SOURCE or -D_POSIX_SOURCE to your command line. That will cause the compilers not to define these symbols. If your program conforms to either of these standards this is likely the way to go.

    2. Comment out the #define hz on <sys/m_param.h>. If you're not allowed to change the system headers, you can create your own copy of this file, on a directory of form /path/sys/m_param.h and then redirect the compiler to use it by adding -I/path to your command line.
    The second solution works.

    It was finally accepted even if it involves modifying a copy of a system header.

    Thank you again for your help.

    Regards,