apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Garrett Rooney <roo...@electricjellyfish.net>
Subject Re: using APR on fedora core 3
Date Wed, 04 Jan 2006 00:17:14 GMT
On 1/3/06, Alex.Krumm-Heller@csiro.au <Alex.Krumm-Heller@csiro.au> wrote:
> Hi Garrett,
>
> > Can you try and reduce this to a simple test case (i.e. one .c file
> > and an actual command you use to compile it) so that we can try to
> > reproduce the problem?  It's rather difficult to say what's wrong
> > without seeing the code and the exact commands being used to build it.
>
> Ok the file is test.cpp:
>
> #include <iostream>
> #include "apr_general.h"
> #include "apr_time.h"
>
> int main(int argc, char* argv[])
> {
>         std::cout << "this is a test" << std::endl;
>
>         if (apr_initialize() != APR_SUCCESS)
>         {
>                 return -1;
>           }
>
>         apr_sleep(apr_time_make(0, 100000));
>
>         apr_terminate();
>
>         return 0;
> }
>
> I compile it using:
>
> g++ -g -Wall -c -pthread -fPIC -I../apr-1.2.2/linux2.6/include -DLINUX=2
> -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE test.cpp
>
> and I get the error about INT64_C not being declared.

The problem is that iostream (well, something that iostream includes
probably) pulls in stdint.h, and since you included iostream before
you included any apr headers, the code in apr.h that defines
__STDC_CONSTANT_MACROS doesn't get a chance to take effect, so
stdint.h never defines INT64_C, which APR needs.  You can avoid the
problem by moving the apr header includes before the iostream header
include, or by adding -D__STDC_CONSTANT_MACROS to your compile
command.

-garrett

Mime
View raw message