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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
06-18-2003, 03:24 AM
|
#1
|
Member
Registered: May 2003
Location: Mars
Distribution: Red Hat Linux 9
Posts: 100
Rep:
|
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.
|
|
|
06-18-2003, 03:27 AM
|
#2
|
Senior Member
Registered: May 2003
Location: Malaysia
Distribution: Slackware, LFS, CentOS
Posts: 1,307
Rep:
|
Perhaps this will be better suited under the Programming forum?
|
|
|
06-18-2003, 03:40 AM
|
#3
|
Senior Member
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440
Rep:
|
Maybe you didn't include the I/O header file:
"#include <iostream.h>"
Put that in and see if it compiles...
-twantrd
|
|
|
06-18-2003, 04:16 AM
|
#4
|
Member
Registered: May 2003
Location: Mars
Distribution: Red Hat Linux 9
Posts: 100
Original Poster
Rep:
|
ya i put in iostream i couldn't use iostream.h because g++ uses the new standard headers.
|
|
|
06-18-2003, 10:36 AM
|
#5
|
Senior Member
Registered: Apr 2003
Location: Toronto, Canada
Distribution: Ubuntu Jaunty (9.04)
Posts: 1,044
Rep:
|
try this -->
#include <iostream>
using namespace std;
..
..
code
..
..
|
|
|
06-18-2003, 10:41 AM
|
#6
|
Senior Member
Registered: Apr 2003
Location: Toronto, Canada
Distribution: Ubuntu Jaunty (9.04)
Posts: 1,044
Rep:
|
with newer header file you have to use
using namespace std;
|
|
|
06-19-2003, 03:06 AM
|
#7
|
Senior Member
Registered: Nov 2002
Location: CA
Distribution: redhat 7.3
Posts: 1,440
Rep:
|
Yes, Jatt_thugz is correct about that...
-twantrd
|
|
|
06-20-2003, 05:57 PM
|
#8
|
Member
Registered: May 2003
Location: Mars
Distribution: Red Hat Linux 9
Posts: 100
Original Poster
Rep:
|
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.
|
|
|
06-20-2003, 06:02 PM
|
#9
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
how are we meant to solve that without the code itself?!
|
|
|
06-20-2003, 06:03 PM
|
#10
|
Member
Registered: Apr 2003
Posts: 69
Rep:
|
check if u forgot to include a ; after namespace std ...
|
|
|
06-20-2003, 07:03 PM
|
#11
|
Senior Member
Registered: Apr 2003
Location: Toronto, Canada
Distribution: Ubuntu Jaunty (9.04)
Posts: 1,044
Rep:
|
you having problems with this?? wow!
#include <iostream>
using namespace std;
void main()
{
cout << "Hello World From About\n";
}
|
|
|
All times are GMT -5. The time now is 09:12 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|