Solved

VC to C++ Builder code conversion

Posted on 2003-10-29
2
429 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
2 Comments
 
LVL 15

Accepted Solution

by:
efn earned 300 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

757 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now