Connecting Tech Pros Worldwide Forums | Help | Site Map

gcc compile error about vector

Huang.Antony@gmail.com
Guest
 
Posts: n/a
#1: Nov 30 '05
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
Guest
 
Posts: n/a
#2: Nov 30 '05

re: gcc compile error about vector


Huang.Antony@gmail.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.



Huang.Antony@gmail.com
Guest
 
Posts: n/a
#3: Nov 30 '05

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

Kai-Uwe Bux
Guest
 
Posts: n/a
#4: Nov 30 '05

re: gcc compile error about vector


Huang.Antony@gmail.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
Rolf Magnus
Guest
 
Posts: n/a
#5: Nov 30 '05

re: gcc compile error about vector


Kai-Uwe Bux wrote:
[color=blue]
> Huang.Antony@gmail.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

Kai-Uwe Bux
Guest
 
Posts: n/a
#6: Nov 30 '05

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
Rolf Magnus
Guest
 
Posts: n/a
#7: Nov 30 '05

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.

Gernot Frisch
Guest
 
Posts: n/a
#8: Nov 30 '05

re: gcc compile error about vector



"Tim Love" <tpl@eng.cam.ac.uk> schrieb im Newsbeitrag
news:dmjq0f$e90$1@gemini.csx.cam.ac.uk...[color=blue]
> Huang.Antony@gmail.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?


Closed Thread