Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VC to C++ Builder code conversion

Posted on 2003-10-29
2
Medium Priority
?
474 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 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

926 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