Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VC to C++ Builder code conversion

Posted on 2003-10-29
2
Medium Priority
?
468 Views
Last Modified: 2010-08-05
I am trying to convert some code from VC to C++ Builder 5 pro.

For the line:
operator string() const;
I get these errors:
Error E2076 .\strtok.h 32: Overloadable operator expected
Error E2040 .\strtok.h 32: Declaration terminated incorrectly

Farther down in the implementation:
inline StrTok::operator string() const
{
  if (curToken)
      return string(curToken,curTokenLength);
  return string("");
}
I get these errors:
Error E2076 .\strtok.h 59: Overloadable operator expected
Error E2040 .\strtok.h 59: Declaration terminated incorrectly

This is a small and relatively uncomplicated class, but I am stuck on what the Borland C++ Builder compiler is looking for.

What should I replace these with?
I tried AnsiString(), but it gave the exact same errors.
0
Comment
Question by:c567591
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
efn earned 1200 total points
ID: 9643549
It doesn't recognize "string" as a type.  I reproduced those error messages in BCB 4 and got rid of them by inserting these lines above the class declaration:

#include <string>

using std::string;

--efn
0
 
LVL 1

Author Comment

by:c567591
ID: 9643644
Well, you just got some easy points.  ;)
Thanks for the quick answer that worked!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question