[mercury-users] MGNUC: problem with missing macros definitions
Simon Taylor
stayl at cs.mu.OZ.AU
Sun Dec 16 13:18:37 AEDT 2001
On 15-Dec-2001, Ondrej Bojar <oboj7042 at ss1000.ms.mff.cuni.cz> wrote:
> I would like to use the strdup() function in my C++ code, let's say in
> cpp_main.cc in the sample. strdup() is defined in string.h, so I expected
> that #include <string.h> will help the compiler to find strdup()
> definition.
>
> Unfortunately, the string.h defines strdup() only
> #if defined __USE_SVID || defined __USE_BSD || defined __USE_XOPEN_EXTENDED
> If I use the Mmakefile in the samples directory to build cpp_main.o with
> MGNUC, it fails, since MGNUC doesn't define any of the required macros.
>
> Also, adding -D__USE_BSD (for example) to MGNUCFLAGS won't help. Mgnuc
> for whatever reason calls gcc more than once and passes the -D only in the
> first run.
mgnuc only invokes gcc once. If you are using glibc, look at
/usr/include/features.h. The first thing it does is to undefine
__USE_BSD and other macros that aren't meant to be set by the user.
> What should I modify to make this work?
Try adding `--no-ansi' to MGNUCFLAGS.
> I expect similar problem to occur anytime in anything, so is there a
> manual on gcc and standard libraries and their options that I could read?
See the "Feature Test Macros" section of the glibc Info file (libc.info).
Simon.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list