Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 01-23-2008, 08:30 PM   #1
LQ Newbie
Registered: Oct 2007
Posts: 8

Rep: Reputation: 0
Error while compiling C++ Program

I just tried the simple pgrogram below

int main()
cout<<"Hello World!\n";
return 0;
BUT IT SHOWED AN ERROR LIKE THIS . Is it bcoz it dont hav glibc headers?

[dinesh@SHADOWMAN Cpp]$ g++ 1.cpp
1.cpp: In function ‘int main()’:
1.cpp:5: error: ‘cout’ was not declared in this scope
Old 01-23-2008, 08:43 PM   #2
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 69

int main()
  std::cout << "Hello, world!\n";
  return 0;
using namespace std;

int main()
  cout << "Hello, world!\n";
  return 0;
Read on namespaces in C++.


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
Error in compiling Postgres FE C program skie_knite007 Programming 2 03-16-2007 10:38 PM
error compiling srgp program in c csst0136 Programming 10 10-25-2005 12:14 AM
error compiling srgp program in c csst0136 SUSE / openSUSE 0 10-23-2005 02:46 PM
error while compiling c /c++ program kiranbud Programming 1 10-12-2005 08:19 PM
error compiling a program minm Linux - Newbie 7 08-01-2005 10:40 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:29 PM.

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