LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-04-2006, 09:16 PM   #1
pranavojha
Member
 
Registered: Feb 2006
Location: Bangalore, India
Distribution: Fedora Core 3
Posts: 68

Rep: Reputation: 15
string in turbo C++


I have been using turbo C++ since a long time in the windows platform. I am not able to use the strings in C++ as we can in java.
for eg: when i write the following in "str.cpp"
string l;
on compiling i get the following error...
Undefined symbol...
am i using a older version of c++ or what?
 
Old 03-04-2006, 09:25 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Turbo C++ is wildly obsolete, and I'd strongly encourage you to find a more recent (ANSI C++ compliant) compiler.

Nevertheless, it *should* have *some* notion of C++ strings, and what you're trying to do *should* work.

Here's an example using an old copy of Borland C++ 5.0 (circa 1997 or so) I have:
Code:
#include <iostream>
#include <string>

int
main (int argc, char *argv[])
{
  string s = "Hello world!\n";
  cout << s;
  return 0;
}
 
Old 03-05-2006, 08:51 AM   #3
pranavojha
Member
 
Registered: Feb 2006
Location: Bangalore, India
Distribution: Fedora Core 3
Posts: 68

Original Poster
Rep: Reputation: 15
Where to download c++ complier??

Quote:
Originally Posted by paulsm4
Turbo C++ is wildly obsolete, and I'd strongly encourage you to find a more recent (ANSI C++ compliant) compiler.

Nevertheless, it *should* have *some* notion of C++ strings, and what you're trying to do *should* work.

Here's an example using an old copy of Borland C++ 5.0 (circa 1997 or so) I have:
Code:
#include <iostream>
#include <string>

int
main (int argc, char *argv[])
{
  string s = "Hello world!\n";
  cout << s;
  return 0;
}
Where can i download the latest version of C++ that contains string classes too (for windows)... plz provide the link
 
Old 03-05-2006, 11:21 AM   #4
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
http://www.bloodshed.net/
 
Old 03-05-2006, 11:55 AM   #5
exit3219
Member
 
Registered: May 2005
Location: Moldova
Distribution: Kubuntu
Posts: 199

Rep: Reputation: 30
On Windows, you may consider using MS Visual Studio.
 
Old 03-05-2006, 02:57 PM   #6
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
Quote:
Originally Posted by exit3219
On Windows, you may consider using MS Visual Studio.
its also free if you use the express edition.. though i havent used it much, i did grab a copy a while back..

http://msdn.microsoft.com/vstudio/ex...c/default.aspx
 
Old 03-07-2006, 07:35 AM   #7
pranavojha
Member
 
Registered: Feb 2006
Location: Bangalore, India
Distribution: Fedora Core 3
Posts: 68

Original Poster
Rep: Reputation: 15
Visual studio??

Quote:
Originally Posted by exit3219
On Windows, you may consider using MS Visual Studio.
I had tried VC++ but i strongly believe that VC++ also doesn't contain string variable(Visual studio 6.0). trust me i did tried this years ago. If you are sure that visual studio contains implicit "string" datatype then plz reply to this. I will try and get that software. Plz be sure.

PS: OS win 2k, p4 3GHz

awaiting your quick response.
 
Old 03-07-2006, 07:41 AM   #8
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
Quote:
I had tried VC++ but i strongly believe that VC++ also doesn't contain string variable(Visual studio 6.0). trust me i did tried this years ago. If you are sure that visual studio contains implicit "string" datatype then plz reply to this. I will try and get that software. Plz be sure.
I don't know how many times i have wrote this, but one more won't hurt.
VS6 is not a C++ compiler.
C++ has strings in the standard namespace.
ie
#include <string>
std::string;
Im sure. lol
 
Old 03-07-2006, 08:15 AM   #9
vharishankar
Senior Member
 
Registered: Dec 2003
Distribution: Debian
Posts: 3,178
Blog Entries: 4

Rep: Reputation: 138Reputation: 138
I think if you use MFC, then you can use CString class. Very convenient.

But it's a long time since I used VC++ so I don't know how much MFC has changed since then.
 
Old 03-07-2006, 03:12 PM   #10
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
> implicit "string"

strings are not automagically made.. you must do as dmail said and
#include <string>
and then declare a string.. and yes they are there, they are standard c++..
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Turbo Linux TigerLinux Linux - Distributions 9 09-27-2005 06:40 AM
Turbo Linux Echo Kilo Linux - Software 1 03-11-2005 01:48 AM
Turbo LInux 10 testament Linux - Distributions 1 07-10-2004 08:29 PM
java test if string in string array is null. exodist Programming 3 02-21-2004 01:39 PM
turbo linux? [cacheflow] Linux - Distributions 3 02-12-2002 06:03 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration