View previous topic :: View next topic |
Author |
Message |
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Sun Jan 02, 2005 2:31 pm Post subject: Compile error - Problem with std::fill |
|
|
I'm having trouble compiling a game that is not yet in Portage. I figured I'd put it here instead of the Games section because I think it has more to do with incompabilities between gcc versions. The game is Aleph One (http://marathon.sourceforge.net) and this is what I get with gcc 3.4.3. I really don't understand this because the parameters that Dim3_Loader.cpp expects std::fill to take are nothing like the parameters that it actually does take.
Code: | if g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../../Source_Files/CSeries -I../../Source_Files/Expat -I../../Source_Files/Files -I../../Source_Files/GameWorld -I../../Source_Files/Input -I../../Source_Files/Misc -I../../Source_Files/Network -I../../Source_Files/Pfhortran -I../../Source_Files/RenderMain -I../../Source_Files/RenderOther -I../../Source_Files/Sound -I../../Source_Files/XML -I/usr/include/SDL -D_REENTRANT -DSDL -I/usr/X11R6/include -L/usr/X11R6/lib -march=pentium4 -O2 -pipe -fomit-frame-pointer -MT Dim3_Loader.o -MD -MP -MF ".deps/Dim3_Loader.Tpo" -c -o Dim3_Loader.o Dim3_Loader.cpp; \
then mv -f ".deps/Dim3_Loader.Tpo" ".deps/Dim3_Loader.Po"; else rm -f ".deps/Dim3_Loader.Tpo"; exit 1; fi
Dim3_Loader.cpp: In function `bool LoadModel_Dim3(FileSpecifier&, Model3D&, int)':
Dim3_Loader.cpp:228: error: no matching function for call to `fill(__gnu_cxx::__normal_iterator<uint32*, std::vector<uint32, std::allocator<uint32> > >, __gnu_cxx::__normal_iterator<uint32*, std::vector<uint32, std::allocator<uint32> > >, <anonymous enum>)'
/usr/lib/gcc/i686-pc-linux-gnu/3.4.3/include/g++-v3/bits/stl_algobase.h:553: note: candidates are: void std::fill(unsigned char*, unsigned char*, const unsigned char&)
/usr/lib/gcc/i686-pc-linux-gnu/3.4.3/include/g++-v3/bits/stl_algobase.h:561: note: void std::fill(signed char*, signed char*, const signed char&)
/usr/lib/gcc/i686-pc-linux-gnu/3.4.3/include/g++-v3/bits/stl_algobase.h:569: note: void std::fill(char*, char*, const char&)
distcc[14679] ERROR: compile Dim3_Loader.cpp on localhost failed
make[2]: *** [Dim3_Loader.o] Error 1
make[2]: Leaving directory `/var/tmp/portage/alephone-20040417/work/aleph_20040417/Source_Files/ModelView'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/alephone-20040417/work/aleph_20040417/Source_Files'
make: *** [install-recursive] Error 1 |
|
|
Back to top |
|
|
markkuk Guru
Joined: 29 Nov 2002 Posts: 446
|
Posted: Sun Jan 02, 2005 3:26 pm Post subject: |
|
|
How about posting the piece of code that triggers the error (Dim3_Loader.cpp around line 228)? From the message it looks like the third parameter to std::fill() has wrong type, it should be uint32 to match the content type of the vector to be filled. |
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Sun Jan 02, 2005 3:45 pm Post subject: |
|
|
Here it is. I think this is talking about the bones of a model or something but that shouldn't really matter. I think there might be further uses of fill further down but these are the first two.
Code: | // Work out the sorted order for the bones; be sure not to repeat this if already done.
if (BoneIndices.empty() && !Model.Bones.empty())
{
size_t NumBones = Model.Bones.size();
BoneIndices.resize(NumBones);
fill(BoneIndices.begin(),BoneIndices.end(),UNONE); // No bones listed -- yet
vector<Model3D_Bone> SortedBones(NumBones);
vector<size_t> BoneStack(NumBones);
vector<bool> BonesUsed(NumBones);
fill(BonesUsed.begin(),BonesUsed.end(),false); |
|
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Sun Jan 02, 2005 3:53 pm Post subject: |
|
|
And from cstypes.h...
Code: | // IR note: consts in headers are slow and eat TOC space.
//const int NONE = -1;
enum {
NONE = -1,
UNONE = 65535
}; |
|
|
Back to top |
|
|
markkuk Guru
Joined: 29 Nov 2002 Posts: 446
|
Posted: Sun Jan 02, 2005 5:54 pm Post subject: |
|
|
It must be complaining about this: Code: | fill(BoneIndices.begin(),BoneIndices.end(),UNONE); |
How is BoneIndices declared? Try casting UNONE to the same type as elements in the BoneIndices vector. |
|
Back to top |
|
|
Chewi Developer
Joined: 01 Sep 2003 Posts: 886 Location: Edinburgh, Scotland
|
Posted: Sun Jan 02, 2005 8:29 pm Post subject: |
|
|
Yeah it worked! There was another gcc 3.4 problem but I fixed that too. Thanks man. |
|
Back to top |
|
|
|