64 bit STL Problem

S

Saurabh Aggrawal

Hi,
I am porting a 32 bit code to 64 bit.I am compiling the code with
64-bit compiler for AMD machine. I am getting the following errors
which are related to STL Library.

Processing directory Ui...
cframe.cpp
G:\NewUIPackers\drivers\Unser\public\VectorIterator.h(102) : warning
C4346: 'std::vector<_Ty>::iterator' : dependent name is not a type
prefix with 'typename' to indicate a type
G:\NewUIPackers\drivers\Unser\public\VectorIterator.h(104) :
see reference to class template instantiation 'VectorIterator<Item>'
being compiled
G:\NewUIPackers\drivers\Unser\public\VectorIterator.h(102) : error
C2146: syntax error : missing ';' before identifier '_iterator'
G:\NewUIPackers\drivers\Unser\public\VectorIterator.h(102) : error
C2501: 'VectorIterator<Item>::_iterator' : missing storage-class or
type specifiers
cframe.cpp(24) : error C2552: 'cfMethods' : non-aggregates cannot be
initialized with initializer list
'std::basic_string<_E,_Tr,_A>' : Types with private or
protected data members are not aggregate
with
[
_E=wchar_t,
_Tr=std::char_traits<wchar_t>,
_A=std::allocator<wchar_t>
]


I have included the path for STL which is
C:\SDKs\srv2003sdk\include\Win64\crt
Any suggestions are welcome,
Thanks,
Saurabh Aggrawal
 
P

Peter Koch Larsen

Hi Saurabh

Not seeing your code forces us to guess, but..
Saurabh Aggrawal said:
Hi,
I am porting a 32 bit code to 64 bit.I am compiling the code with
64-bit compiler for AMD machine. I am getting the following errors
which are related to STL Library.

Processing directory Ui...
cframe.cpp
G:\NewUIPackers\drivers\Unser\public\VectorIterator.h(102) : warning
C4346: 'std::vector<_Ty>::iterator' : dependent name is not a type
prefix with 'typename' to indicate a type

This message tells you have forgotten a "typename" somewhere. For template
code you have to prefix a templated type with typename, e.g.

template <t> void f(t &t)
{
typename t::iterator i;
.....


The errorcode seems to indicate this takes place in the standard library.
Perhaps you should show us some more code.


Kind regards
Peter
[snip]
 
S

Saurabh Aggrawal

All the errors are on the line no.102, below is the code at line no.
102

98: private:
99: //-------- Instance Data --------
100: //
101: bool _before;
102: vector<Item>::iterator _iterator; // actual working iterator
103: vector<Item>& _vector; // STL based vector
104: };
 
T

Tom Widmer

All the errors are on the line no.102, below is the code at line no.
102

98: private:
99: //-------- Instance Data --------
100: //
101: bool _before;
102: vector<Item>::iterator _iterator; // actual working iterator

Should be:

typename vector<Item>::iterator _iterator;

VC7.1 is more standards compliant than previous MS compilers, and the
standard requires the use of "typename" when referring to a nested
name that is a type in a type which depends on a template parameter
(in this case, Item). If you don't include "typename", the
"::iterator" above is assumed to refer to a member variable or
function!

So your problem isn't STL related, but language related.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top