473,473 Members | 1,824 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Migrating C++ code from gcc 2.96 yo 3.4.4

1 New Member
Hi,

I'm in the process of porting some C++ code written for a linux environment from gcc version 2.96 yo 3.4.3.

Unfortunately, I got stuck when it came to porting some STL map related code. I did some research but I can't seem to find the modification required to overcome the problem.

In the header file I've got the following map defined:

// Map of Port Description -> PortInfo*
typedef map<Description, PortInfo*, less<Description> > PortDescriptionsMap;

typedef PortDescriptionsMap::iterator PortDescriptionsMapIterator;
typedef PortDescriptionsMap::value_type PortDescriptionsMapValue;
typedef pair<PortDescriptionsMapIterator, bool > DescriptionsInsertResult;
PortDescriptionsMap portDescriptionsMap;

where:
'Description' is a class representing an array of characters and
'PortInfo' is another class

When I compile the following code segment I get an error, which is associated to the last line in the code segment:


if (portNumbersMap.size() > 0)
{
PortNumbersMapIterator iterator = portNumbersMap.begin();

==>> if(iterator != portDescriptionsMap.end())



ports.cpp:479: error: no match for 'operator!=' in 'iterator != (((std::map<Description, PortInfo*, std::less<Description>, std::allocator<std::pair<const Description, PortInfo*> > >*)((Ports*)this)) + 84u)->std::map<_Key, _Tp, _Compare, _Alloc>::end [with _Key = Description, _Tp = PortInfo*, _Compare = std::less<Description>, _Alloc = std::allocator<std::pair<const Description, PortInfo*> >]()'
/usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3/bits/stl_tree.h:213: note: candidates are: bool std::_Rb_tree_iterator<_Tp>::operator!=(const std::_Rb_tree_iterator<_Tp>&) const [with _Tp = std::pair<const PortNumber, Description>]
__________________________________________________

The compile error refers to templates. I expect they are implicitly used in maps. I also realise that 'typename' needs to be used when we've got templates. However, if I add it to the header file as follows

typedef typename PortDescriptionsMap::iterator PortDescriptionsMapIterator;

or in the code itself

typename PortNumbersMapIterator iterator = portNumbersMap.begin();

I get 'typename' used outside template error.

I would greatly appreciate any suggestions from others in the community.

Thanks in advance,
Shiraz
Melbourne, Australia
Mar 13 '06 #1
1 2292
Banfa
9,065 Recognized Expert Moderator Expert
The error is telling you the problem

no match for 'operator!=' in 'iterator != <snipped for clarity>'

It is saying that in the line of code

if(iterator != portDescriptionsMap.end())

If can find no defined operator for != for the types in the comparison.

You need to define the operator for this line of code to work.

Unfortunately it is late and I am having trouble divining the correct syntax for this operator to give you.
Mar 14 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Paco | last post by:
Hi fellow programmers: Is there an option (within vstudio.net) or a tool that would allow me to 'convert' VB6 source code to vb.net? If not, are condemned to re-write the application. I...
4
by: Juan | last post by:
I'm migrating a VB.Net app to c# and found the following: Private m_State(,) As Integer If anyone knows what is the analogous in c#... is it an array? Thanks, Juan.
6
by: Shai Levi | last post by:
Hi, I'm trying to migrate native c++ class to managed c++ class. The native class header definition looks as: class NativeClass { public: typedef void (CbFunc1)(int n,void* p);
0
by: michael | last post by:
I am migrating C++ unmanaged to managed VC 7.1. I continue to have problems with try catch blocks through-out my code. The compile tells me the the code is unreachable C2407 at the catch portion of...
3
by: BobRoyAce | last post by:
I would really appreciate recommendations for sources of materials on migrating ASP applications to ASP.NET (books, URL's, etc.). Also, is there a magazine that is particularly good for .NET stuff....
9
by: skulkrinbait | last post by:
Hello, I need some help please. I need to migrate some applications from OS2 to Windows, the source code is C. I believe this can be done using Lex and Yacc and have installed Cygwin with Flex...
34
by: subramanian100in | last post by:
Is there any difference between porting and migrating. Kindly explain
1
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I am involved in migrating a sizeable vb6 application to vb.net but don't want to add the extra complexity of migrating adodb to ado.net. Is this a sensible approach and if not what are the...
9
by: WT | last post by:
Hello, I have code created with .net 1.0 and migrated to 3.5. Form 2.0 the XslTransform class is obsolete and the vs2008 compiler generates warnings that these classes are absolete suggesting to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.