Compiler error
I'm having trouble fixing this error from the following code (part of OpenGL Shading Language Compiler):
This also has to do with Intermediate.h, which is too big to post. You can download the compiler at http://www.3dlabs.com/support/developer/.../index.htm
I get the following errors:
I can't seem to determine what the problem is. I see rebind in the STL header files, yet it seems to think it is not there....
Code:
typedef pool_allocator<char> TStringAllocator;
typedef std::basic_string <char, std::char_traits<char>, TStringAllocator > TString;
inline TString* NewPoolTString(char* s)
{
void* memory = GlobalPoolAllocator.allocate(sizeof(TString));
return new(memory) TString(s);
}I get the following errors:
Code:
In file included from include/intermediate.h:36,
from MachineIndependent/Initialize.cpp:28:
/usr/include/gcc/darwin/3.1/g++-v3/bits/basic_string.h: In instantiation of `std::basic_string<char, std::char_traits<char>, TStringAllocator>::_Rep':
/usr/include/gcc/darwin/3.1/g++-v3/bits/basic_string.tcc:67: instantiated from `std::basic_string<char, std::char_traits<char>, TStringAllocator>'
include/common.h:64: instantiated from here
/usr/include/gcc/darwin/3.1/g++-v3/bits/basic_string.h:126: no class template named `rebind' in `class TStringAllocator'
include/common.h:83: warning: ISO C++ forbids declaration of `Min' with no type
include/common.h:84: warning: ISO C++ forbids declaration of `Max' with no type
In file included from MachineIndependent/Initialize.cpp:28:
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_alloc.h: In instantiation of `std::_Alloc_traits<TIntermNode*, pool_allocator<TIntermNode*> >':
include/intermediate.h:432: instantiated from `std::_Vector_base<TIntermNode*, pool_allocator<TIntermNode*> >'
include/intermediate.h:432: instantiated from `std::vector<TIntermNode*, pool_allocator<TIntermNode*> >'
include/intermediate.h:432: instantiated from `TVector<TIntermNode*>'
include/intermediate.h:432: instantiated from here
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_alloc.h:844: no class template named `rebind' in `class pool_allocator<TIntermNode*>'
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h: In instantiation of `std::_Vector_alloc_base<TIntermNode*, pool_allocator<TIntermNode*>, false>':
include/intermediate.h:432: instantiated from `std::_Vector_base<TIntermNode*, pool_allocator<TIntermNode*> >'
include/intermediate.h:432: instantiated from `std::vector<TIntermNode*, pool_allocator<TIntermNode*> >'
include/intermediate.h:432: instantiated from `TVector<TIntermNode*>'
include/intermediate.h:432: instantiated from here
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h:90: no type named `allocator_type' in `struct std::_Alloc_traits<TIntermNode*, pool_allocator<TIntermNode*> >'
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h:82: no type named `allocator_type' in `struct std::_Alloc_traits<TIntermNode*, pool_allocator<TIntermNode*> >'
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h:83: no type named `allocator_type' in `struct std::_Alloc_traits<TIntermNode*, pool_allocator<TIntermNode*> >'
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h:86: no type named `allocator_type' in `struct std::_Alloc_traits<TIntermNode*, pool_allocator<TIntermNode*> >'
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h: In instantiation of `std::_Vector_base<TIntermNode*, pool_allocator<TIntermNode*> >':
include/intermediate.h:432: instantiated from `std::vector<TIntermNode*, pool_allocator<TIntermNode*> >'
include/intermediate.h:432: instantiated from `TVector<TIntermNode*>'
include/intermediate.h:432: instantiated from here
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h:134: no type named `allocator_type' in `class std::_Vector_alloc_base<TIntermNode*, pool_allocator<TIntermNode*>, false>'
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h: In instantiation of `std::_Vector_base<TIntermNode*, pool_allocator<TIntermNode*> >':
include/intermediate.h:432: instantiated from `std::vector<TIntermNode*, pool_allocator<TIntermNode*> >'
include/intermediate.h:432: instantiated from `TVector<TIntermNode*>'
include/intermediate.h:432: instantiated from here
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h:136: no type named `allocator_type' in `class std::_Vector_alloc_base<TIntermNode*, pool_allocator<TIntermNode*>, false>'
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h: In instantiation of `std::_Vector_base<TIntermNode*, pool_allocator<TIntermNode*> >':
include/intermediate.h:432: instantiated from `std::vector<TIntermNode*, pool_allocator<TIntermNode*> >'
include/intermediate.h:432: instantiated from `TVector<TIntermNode*>'
include/intermediate.h:432: instantiated from here
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h:137: no type named `allocator_type' in `class std::_Vector_alloc_base<TIntermNode*, pool_allocator<TIntermNode*>, false>'
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h: In instantiation of `std::vector<TIntermNode*, pool_allocator<TIntermNode*> >':
include/intermediate.h:432: instantiated from `TVector<TIntermNode*>'
include/intermediate.h:432: instantiated from here
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h:186: no type named `allocator_type' in `struct std::_Vector_base<TIntermNode*, pool_allocator<TIntermNode*> >'
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h:187: no type named `allocator_type' in `struct std::_Vector_base<TIntermNode*, pool_allocator<TIntermNode*> >'
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h:333: no type named `allocator_type' in `struct std::_Vector_base<TIntermNode*, pool_allocator<TIntermNode*> >'
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h:337: no type named `allocator_type' in `struct std::_Vector_base<TIntermNode*, pool_allocator<TIntermNode*> >'
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h:352: no type named `allocator_type' in `struct std::_Vector_base<TIntermNode*, pool_allocator<TIntermNode*> >'
/usr/include/gcc/darwin/3.1/g++-v3/bits/stl_vector.h:352: confused by earlier errors, bailing outI can't seem to determine what the problem is. I see rebind in the STL header files, yet it seems to think it is not there....
Is it just me, or is it trying to repeat class declarations (a double include)?
It might also be a wierd invis ASCII character that's throwing something off, as all the errors are on line 432, but that's a long shot.
It might also be a wierd invis ASCII character that's throwing something off, as all the errors are on line 432, but that's a long shot.
Good idea... but nope on both fronts. Some of the header files were not wrapped with #ifndef HEADER_NAME_H_INCLUDED and some of the #includes had "../Include/..." rather than "../include/..." but after fixing all of these, I had the same errors. After a bit of searching, I think it has to do with either the typename keyword or with Apple's STL implementation relative to MSVC++'s STL implementation, or quite possibly it could be both. The code has a few other non-conformant sections, such as the use of itoa, which are not standards conformant. I suspect that the typename keyword usage is to blame. If this is true, I'll have to correct significant amounts of code, because that keyword is used extensively.
You might like to try compiling with GCC 2.95 rather than 3.1, as 3.1 is rather stricter about typename than 2.95.
My personal guess, though, is simply differences in the STL between the two. The "S" in the acronym is rather misleading...
My personal guess, though, is simply differences in the STL between the two. The "S" in the acronym is rather misleading...
The first error looks like it's saying that pool_allocator doesn't have the right interface to be used with basic_string...
The rest of the errors are probably related or red herrings
Quote:/usr/include/gcc/darwin/3.1/g++-v3/bits/basic_string.h:126: no class template named `rebind' in `class TStringAllocator'
The rest of the errors are probably related or red herrings
Heh, they should call it MTL "Microsoft Template Library" in Visual C++. 
Gcc2.x compiles with the same errors.
I'll look into the allocator interface.... I don't have a decent and up to date STL reference, so I'll have to search the web. Thanks for all the comments. I'm a little inexperienced with porting code, so I'm not always sure of what to look for.

Gcc2.x compiles with the same errors.
I'll look into the allocator interface.... I don't have a decent and up to date STL reference, so I'll have to search the web. Thanks for all the comments. I'm a little inexperienced with porting code, so I'm not always sure of what to look for.
You should have said. You're in for a world of trouble trying to port from MSVS.
Searching through the headers on your MAC will be just as good as searching the net. Find out what rebind does and add it to your pool_allocator.
Try looking in somewhere like bits/stl_alloc.h or similar.
Searching through the headers on your MAC will be just as good as searching the net. Find out what rebind does and add it to your pool_allocator.
Try looking in somewhere like bits/stl_alloc.h or similar.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Open Source Cg compiler adventures | JeroMiya | 4 | 4,005 |
Sep 16, 2002 06:58 PM Last Post: JeroMiya |
|
| BSP tree compiler | ClarustheDogCow | 3 | 3,404 |
Jul 4, 2002 09:30 AM Last Post: ClarustheDogCow |
|

