This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Conflict between STL and linux rx.h inclusion


Hello.

I appear to be having a symbol-naming conflict between the STL under
egcs-1.0.3a and the regex implementation that I have on my linux system.
It leads to a general question about what symbol names are reserved in
the STL world.

My Setup:
 . 166MH Pentium
 . 64MB memory
 . Linux 2.0.30 (the Slackware 3.4 distribution)
 . egcs-1.03a, which I install in /usr/gnu, to avoid clobbering the
   gcc-2.7.? version that came with the distribution.
 . /usr/gnu/bin occurs earlier in my PATH than /usr/bin

My Program:
   One of the files I compile does the following includes:

   #include <map>
   #include <regex.h>

This leads to the following error message:

    g++  -g -c reg_exp.cc
    In file included from /usr/include/regex.h:1,
                     from reg_exp.hh:21,
                     from reg_exp.cc:20:
    /usr/include/rx.h:414: semicolon missing after struct declaration
    make: *** [reg_exp.o] Error 1

The relevant snippet from /usr/include/rx.h is

        /* Nodes in a syntax tree are of this type:
         */
        struct rexp_node
        {
          enum rexp_node_type type;
          union
          {
            rx_Bitset cset;
            rx_side_effect side_effect;
            struct
              {
                struct rexp_node *left;
                struct rexp_node *right;
              } pair;
--- error here -----^
            void * data;
          } params;
        };


By this time, <map> has (apparently) defined pair quite differently.

If I reverse the two includes, there is an untoward consequence, but I
don't recall what it is right now, and can't easily get to my system.

(I also recall having problems with the ordering of the inclusions

  #include <string>
  #include <vector>

but found that reversing them seemed to eradicate the symptom (might have
been under egcs-1.0.2).

My questions:

  1) I wonder if there are special rules about the ordering of inclusions
     that one must use when programming with STL, and other portions of
     the C++ Standard Library set.

  2) Is there a published set of symbols (outside of those involved by
     the C++ language itself) that I (and system files I include) cannot
     use?

  2) Am I doing something wrong? Is there is a bug here?  If so, does it
     belong to the regex code, or to egcs?

Thanks,

/ken dawson


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]