c9s / r3

libr3 is a high-performance path dispatching library. It compiles your route paths into a prefix tree (trie). By using the constructed prefix trie in the start-up time, you may dispatch your routes with efficiency
http://c9s.github.com/r3/bench.html
MIT License
813 stars 83 forks source link

c++ support for r3 can't compile on gcc-4.1.2 #84

Open coney opened 8 years ago

coney commented 8 years ago

when compiling the example simple_cpp.cpp, the typedef from pcre header causes a compile error:

In file included from ../include/r3.hpp:11,
                 from simple_cpp.cpp:4:
../include/r3.h:50: error: declaration of ‘pcre_extra* _node::pcre_extra’
/usr/local/include/pcre.h:385: error: changes meaning of ‘pcre_extra’ from ‘typedef struct pcre_extra pcre_extra’
In file included from simple_cpp.cpp:4:

the code snippet from pcre.h:385:

typedef struct pcre_extra {
  unsigned long int flags;        /* Bits for which fields are set */
  void *study_data;               /* Opaque data from pcre_study() */
  unsigned long int match_limit;  /* Maximum number of calls to match() */
  void *callout_data;             /* Data passed back in callouts */
  const unsigned char *tables;    /* Pointer to character tables */
  unsigned long int match_limit_recursion; /* Max recursive calls to match() */
  unsigned char **mark;           /* For passing back a mark pointer */
  void *executable_jit;           /* Contains a pointer to a compiled jit code */
} pcre_extra;
zhiyong0804 commented 4 years ago

yes, i encounter this error on centos 6, what‘s should we do?

bjosv commented 8 months ago

When building r3 and simple_cpp.cpp using an old compiler like g++-4.4.7 you get this build error. It compiles just fine if you use a later GCC like 4.8 (from March 2013), so the recommendation is to use a more recent compiler.

Since CentOS 6 is EOF (End of life) since 2020 you should at least use CentOS 7, which provides g++-4.8.5 and works fine when I compared.

Are we OK with closing this issue with above recommendation?