LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-18-2003, 02:24 AM   #1
andox
Member
 
Registered: May 2003
Location: Mars
Distribution: Red Hat Linux 9
Posts: 100

Rep: Reputation: 15
g++


for some reason i can't seem to compile and link my codes..
it keeps saying ...

test.c++:5: `cout' undeclared (first use this function)
test.c++:5: (Each undeclared identifier is reported only once for each function it appears in.)


can anyone please help? that'd be great.
 
Old 06-18-2003, 02:27 AM   #2
Azmeen
Senior Member
 
Registered: May 2003
Location: Malaysia
Distribution: Slackware, LFS, CentOS
Posts: 1,307

Rep: Reputation: 46
Perhaps this will be better suited under the Programming forum?
 
Old 06-18-2003, 02:40 AM   #3
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
Maybe you didn't include the I/O header file:

"#include <iostream.h>"

Put that in and see if it compiles...

-twantrd
 
Old 06-18-2003, 03:16 AM   #4
andox
Member
 
Registered: May 2003
Location: Mars
Distribution: Red Hat Linux 9
Posts: 100

Original Poster
Rep: Reputation: 15
ya i put in iostream i couldn't use iostream.h because g++ uses the new standard headers.
 
Old 06-18-2003, 09:36 AM   #5
ksgill
Senior Member
 
Registered: Apr 2003
Location: Toronto, Canada
Distribution: Ubuntu Jaunty (9.04)
Posts: 1,044

Rep: Reputation: 45
try this -->

#include <iostream>
using namespace std;
..
..
code
..
..
 
Old 06-18-2003, 09:41 AM   #6
ksgill
Senior Member
 
Registered: Apr 2003
Location: Toronto, Canada
Distribution: Ubuntu Jaunty (9.04)
Posts: 1,044

Rep: Reputation: 45
with newer header file you have to use

using namespace std;


 
Old 06-19-2003, 02:06 AM   #7
twantrd
Senior Member
 
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440

Rep: Reputation: 52
Yes, Jatt_thugz is correct about that...

-twantrd
 
Old 06-20-2003, 04:57 PM   #8
andox
Member
 
Registered: May 2003
Location: Mars
Distribution: Red Hat Linux 9
Posts: 100

Original Poster
Rep: Reputation: 15
Ya it worked with using namespance std.. but i still have a problem it says..

test.c++:in function int main()
test.c++:7: parse error before ')' token

it's jus a simple hello world program. iun get it.
 
Old 06-20-2003, 05:02 PM   #9
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
how are we meant to solve that without the code itself?!
 
Old 06-20-2003, 05:03 PM   #10
madiyaan
Member
 
Registered: Apr 2003
Posts: 69

Rep: Reputation: 15
check if u forgot to include a ; after namespace std ...
 
Old 06-20-2003, 06:03 PM   #11
ksgill
Senior Member
 
Registered: Apr 2003
Location: Toronto, Canada
Distribution: Ubuntu Jaunty (9.04)
Posts: 1,044

Rep: Reputation: 45
you having problems with this?? wow!

#include <iostream>
using namespace std;
void main()
{
cout << "Hello World From About\n";
}
 
  


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



LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:28 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration