473,378 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

error: expected `;' before 'itr' template compile error? Solaris vsLinux

Im compiling code on Fedora and I get the following error:

202: error: expected `;' before 'itr'

this is in a .h file which has no .cpp file:

template < typename Tcharl, typename Tcharr >
inline std::basic_string<Tcharl>& CR_String::StrCpy
( std::basic_string<Tcharl&dest, const std::basic_string<Tcharr>
&src )
{
std::basic_string<Tcharr>::const_iterator itr = src.begin();
<---- line 202

while ( itr != src.end() )
{
dest.append( 1, Tcharl(*itr) );
itr++;
}
return dest;
}

Compile flags: -Wall -g

Compiler g++ version 4.0.0

Ive compiled this same code on Solaris 10 and Windows 2003 just fine.
It seems to be having issues with Tcharr because if I change it to an
int,
its fine, however I havent been able to figure out how to properly fix
it
for Linux and why its occuring only on Linux and not Solaris or
Windows?

Thanks in advance
Mar 11 '08 #1
3 3383
Jeff wrote:
Im compiling code on Fedora and I get the following error:

202: error: expected `;' before 'itr'

this is in a .h file which has no .cpp file:

template < typename Tcharl, typename Tcharr >
inline std::basic_string<Tcharl>& CR_String::StrCpy
( std::basic_string<Tcharl&dest, const std::basic_string<Tcharr>
&src )
{
std::basic_string<Tcharr>::const_iterator itr = src.begin();
Prepend "typename"... i.e.
typenaame std::basic_string<Tcharr>::const_iterator itr = src.begin();

The FAQ I'm sure covers the use of typename - otherwise a google groups
search will also give you and answer.
<---- line 202

while ( itr != src.end() )
{
dest.append( 1, Tcharl(*itr) );
itr++;
}
return dest;
}

Compile flags: -Wall -g

Compiler g++ version 4.0.0

Ive compiled this same code on Solaris 10 and Windows 2003 just fine.
It seems to be having issues with Tcharr because if I change it to an
int,
its fine, however I havent been able to figure out how to properly fix
it
for Linux and why its occuring only on Linux and not Solaris or
Windows?

Thanks in advance
Mar 11 '08 #2
Jeff wrote:
Im compiling code on Fedora and I get the following error:

202: error: expected `;' before 'itr'

this is in a .h file which has no .cpp file:

template < typename Tcharl, typename Tcharr >
inline std::basic_string<Tcharl>& CR_String::StrCpy
( std::basic_string<Tcharl&dest, const std::basic_string<Tcharr>
&src )
{
std::basic_string<Tcharr>::const_iterator itr = src.begin();
Prepend "typename"... i.e.
typenaame std::basic_string<Tcharr>::const_iterator itr = src.begin();

The FAQ I'm sure covers the use of typename - otherwise a google groups
search will also give you and answer.
<---- line 202

while ( itr != src.end() )
{
dest.append( 1, Tcharl(*itr) );
itr++;
}
return dest;
}

Compile flags: -Wall -g

Compiler g++ version 4.0.0

Ive compiled this same code on Solaris 10 and Windows 2003 just fine.
It seems to be having issues with Tcharr because if I change it to an
int,
its fine, however I havent been able to figure out how to properly fix
it
for Linux and why its occuring only on Linux and not Solaris or
Windows?

Thanks in advance
Mar 11 '08 #3
On Mar 11, 1:25 pm, Gianni Mariani <gi4nos...@mariani.wswrote:
>
Prepend "typename"... i.e.
typenaame std::basic_string<Tcharr>::const_iterator itr = src.begin();

The FAQ I'm sure covers the use of typename - otherwise a google groups
Thanks, that fixed it!
Mar 11 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Enos Meroka | last post by:
Hallo, I am a student doing my project in the university.. I have been trying to compile the program using HP -UX aCC compiler, however I keep on getting the following errors. ...
1
by: Lionel van den Berg | last post by:
Hi all, I'm having a problem porting from qt2.x to qt3.x. I have posted on a qt forum but no joy as yet so I thought that maybe someone here could shed some more light on what the compiler is...
4
by: Aaron Walker | last post by:
Greetings, I'm attempting to write my first *real* template function that also deals with a map of strings to member function pointers that is making the syntax a little tricky to get right. ...
5
by: cranium.2003 | last post by:
hi, Here is my code #include <iostream.h> int main() { cout <<"HI"; return 0; } and using following command to compile a C++ program g++ ex1.cpp -o ex1
3
by: manoj.pattanaik | last post by:
Hi, I am trying to compile following piece of code (bb.cpp) using aCC (HP ANSI C++ B3910B A.03.37) compiler on HP-UX 11.23. It gives error:485 //bb.cpp -- Starts #include <iostream> using...
2
by: etienne | last post by:
Hello, I'm trying to compile this C++ code with gcc 3.4.5 under Solaris/SPARC (from a complete application, the file is : FullLinkedList.hh) but the make fails (no problem when compiling under...
0
by: alokverma | last post by:
Hi all, I am trying to compile some code on HP-UX-Itanium faluire. using aCC: HP C/aC++ B3910B A.06.12 I have written a sample code below and using the following compilation command. *aCC...
1
by: BSand0764 | last post by:
I'm getting an error that I can't seem to resolve. When I compile the Functor related logic in a test program, the files compile and execute properly (see Listing #1). However, when I...
3
by: Hill | last post by:
This is an simple map, just an exercise. Who can help me fix this compile issue?Thanks in advance. #include <string> #include <vector> #include <iostream> using std::vector; using std::string;...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.