LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 02-18-2003, 05:11 AM   #1
cyberswami
Member
 
Registered: Jan 2003
Location: TVM,Kerala,INDIA
Distribution: Redhat 8.0
Posts: 47

Rep: Reputation: 15
C++ problem , string.h not functioning properly


Supposing i have a sample problem as follows :-
#include <string.h>
#include <iostream>
int main()
{
string test;
test= "this is a test";
cout<<name;
return 0;
}
and save it as test.cc

on compiling it the following error occurs :--
test.cc: In function `int main()':
test.cc:5: `string' undeclared (first use this function)
test.cc:5: (Each undeclared identifier is reported only once for each function
it appears in.)
test.cc:5: parse error before `;' token
test.cc:6: `name' undeclared (first use this function)
test.cc:7: `cout' undeclared (first use this function)

but the string.h file is in the /usr/share directory

what could be the problem
pls help
 
Old 02-18-2003, 10:05 AM   #2
Palin
Member
 
Registered: Feb 2003
Location: A Meatlocker, well feels like one
Distribution: Gentoo
Posts: 292

Rep: Reputation: 30
use <string> instead of <string.h> you will probably need to add some stuff

like std::cout I believe
 
Old 02-18-2003, 10:16 AM   #3
finidi
Member
 
Registered: Dec 2002
Location: World
Distribution: Fedora Core 4
Posts: 127

Rep: Reputation: 15
using namespace std;
 
Old 02-18-2003, 10:34 PM   #4
cyberswami
Member
 
Registered: Jan 2003
Location: TVM,Kerala,INDIA
Distribution: Redhat 8.0
Posts: 47

Original Poster
Rep: Reputation: 15
thanx man, it worked
 
Old 02-18-2003, 11:20 PM   #5
moeminhtun
Member
 
Registered: Dec 2002
Location: Singapore
Distribution: Fedora Core 6
Posts: 647

Rep: Reputation: 30
This thread would be helpful.

http://www.linuxquestions.org/questi...threadid=43963
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
File and folder permissions not functioning properly. MahsanS Linux - General 1 09-28-2005 12:37 PM
File and folder permissions not functioning properly. MahsanS Linux - Security 1 09-28-2005 12:36 PM
File and folder permissions not functioning properly. MahsanS Linux - Networking 1 09-28-2005 12:36 PM
PCMCIA NIC not functioning properly in Fedora analogkid Linux - Laptop and Netbook 2 01-17-2005 11:01 AM
TCPIP not functioning properly safescott Linux - Networking 8 06-02-2003 01:13 AM


All times are GMT -5. The time now is 02:48 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration