[Coin-discuss] name clashes in preprocessor directives

Andreas Waechter andreasw at watson.ibm.com
Fri Feb 22 08:58:30 EST 2008


Hi,

We face a similar problem since all COIN projects use autoconf 
independently, i.e., those preprocessor macros are defined for all 
projects (such as CoinUtils, Clp, etc).  The way we go around this 
error/warning message is by undefining those macros, with

/* undefine macros that could conflict with those in other config.h
    files */
#undef PACKAGE
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION
#undef VERSION

We do this by never directly including config_coinutils.h in our source 
codes, but instead we include a wrapper, which includes the autoheader 
file config_coinutils.h but immediately undefines the macros that lead to 
conflits.

You may have a look at the CoinUtils/src/CoinUtilsConfig.h as an example, 
in case you decide to handle this in your code in a similar manner.

I hope this helps,

Andreas

On Fri, 22 Feb 2008, Tuomo Takkula wrote:

> Hi,
>
> in a project where we use Coin we include headers which leads to name clashes at the following
> preprocessor directives:
>
> coin-Cbc/include/coin/config_coinutils.h:121:1: warning: "PACKAGE"
> coin-Cbc/include/coin/config_coinutils.h:124:1: warning: "PACKAGE_BUGREPORT"
> coin-Cbc/include/coin/config_coinutils.h:127:1: warning: "PACKAGE_NAME"
> coin-Cbc/include/coin/config_coinutils.h:130:1: warning: "PACKAGE_STRING"
> coin-Cbc/include/coin/config_coinutils.h:133:1: warning: "PACKAGE_TARNAME"
> coin-Cbc/include/coin/config_coinutils.h:136:1: warning: "PACKAGE_VERSION"
> coin-Cbc/include/coin/config_coinutils.h:154:1: warning: "VERSION"
>
> The clashes stem from the fact that we are using Coin in a automake/autoconf environment ourselves.
> Is there a way to get rid of those, maybe by the use of some prefix in the call of configure?
>
> Cheers
> Tuomo Takkula
>
> _______________________________________________
> Coin-discuss mailing list
> Coin-discuss at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/coin-discuss
>



More information about the Coin-discuss mailing list