gcc compile error about vector

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Huang.Antony@gmail.com

    #1

    gcc compile error about vector

    HI, when I try the following code, I get a compile error with gcc3.3
    under mac OS.

    int fill;

    struct emp{
    int f;
    };

    #include <vector>

    void test(void)
    {
    std::vector<emp > vt;

    vt.resize(2);
    }

    run 'gcc -x c++ -c -o t.o t.cpp'
    gcc can't compile that code.

    I'd appreciate any help on this issue.

    Tony

  • Tim Love

    #2
    Re: gcc compile error about vector

    Huang.Antony@gm ail.com writes:
    [color=blue]
    >HI, when I try the following code, I get a compile error with gcc3.3
    >under mac OS.[/color]
    Under Linux I get an error saying (amongst other things)

    foo.cc:1: error: `fill' is not a function,
    /usr/include/g++/bits/stl_algobase.h: 561: error: conflict with `void
    std::fill(char* , char*, const char&)'

    which goes away when I comment out the "int fill;" line.



    Comment

    • Huang.Antony@gmail.com

      #3
      Re: gcc compile error about vector


      I can't comment out the variant that named fill, because 'fill' is
      defined by standard Quick Time's header in my project.

      Do you have any more suggestion?

      thanks for your help.

      Tony

      Comment

      • Kai-Uwe Bux

        #4
        Re: gcc compile error about vector

        Huang.Antony@gm ail.com wrote:
        [color=blue]
        >
        > I can't comment out the variant that named fill, because 'fill' is
        > defined by standard Quick Time's header in my project.
        >
        > Do you have any more suggestion?[/color]

        More recent versions of g++ do not have this problem. You might want to
        upgrade.

        Also, asking on a gcc mailing list may be more helpful.



        Best

        Kai-Uwe Bux

        Comment

        • Rolf Magnus

          #5
          Re: gcc compile error about vector

          Kai-Uwe Bux wrote:
          [color=blue]
          > Huang.Antony@gm ail.com wrote:
          >[color=green]
          >>
          >> I can't comment out the variant that named fill, because 'fill' is
          >> defined by standard Quick Time's header in my project.
          >>
          >> Do you have any more suggestion?[/color]
          >
          > More recent versions of g++ do not have this problem. You might want to
          > upgrade.[/color]

          The versions that do have this problem are very old and outdated.
          [color=blue]
          > Also, asking on a gcc mailing list may be more helpful.[/color]

          There also is the newsgroup gnu.g++.help

          Comment

          • Kai-Uwe Bux

            #6
            [OT] Re: gcc compile error about vector

            Rolf Magnus wrote:
            [color=blue]
            > Kai-Uwe Bux wrote:
            >[/color]
            [snip][color=blue][color=green]
            >> More recent versions of g++ do not have this problem. You might want to
            >> upgrade.[/color]
            >
            > The versions that do have this problem are very old and outdated.[/color]

            Very old? The version gcc-3.3.6, which suffers from this defect, was
            released half a year ago. Also, it happens to be the default g++ on my
            Gentoo box. I figure, those versions must still be pretty widely used: more
            recent versions are also much more standard compliant (as opposed to a lot
            of the code that you need the compiler to compile).


            Best

            Kai-Uwe Bux

            Comment

            • Rolf Magnus

              #7
              Re: [OT] Re: gcc compile error about vector

              Kai-Uwe Bux wrote:
              [color=blue][color=green][color=darkred]
              >>> More recent versions of g++ do not have this problem. You might want to
              >>> upgrade.[/color]
              >>
              >> The versions that do have this problem are very old and outdated.[/color]
              >
              > Very old? The version gcc-3.3.6, which suffers from this defect, was
              > released half a year ago.[/color]

              Hmm, sorry. Then it's not the bug I was thinking about.

              Comment

              • Gernot Frisch

                #8
                Re: gcc compile error about vector


                "Tim Love" <tpl@eng.cam.ac .uk> schrieb im Newsbeitrag
                news:dmjq0f$e90 $1@gemini.csx.c am.ac.uk...[color=blue]
                > Huang.Antony@gm ail.com writes:
                >[color=green]
                >>HI, when I try the following code, I get a compile error with gcc3.3
                >>under mac OS.[/color]
                > Under Linux I get an error saying (amongst other things)
                >
                > foo.cc:1: error: `fill' is not a function,
                > /usr/include/g++/bits/stl_algobase.h: 561: error: conflict with
                > `void
                > std::fill(char* , char*, const char&)'
                >
                > which goes away when I comment out the "int fill;" line.[/color]

                putting the code in a namespace?


                Comment

                Working...