Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: error while cout command compiling

Reply
Thread Tools

Re: error while cout command compiling

 
 
ehab
Guest
Posts: n/a
 
      07-06-2003
Here they are my trials : please judge I can not find where is error

Trial #1 :
---------
#include <iostream>
/*using namespace std;
int main() {*/
int main(int argc, char **argv) {
/*std::cout<<"hello world"<<std::end1;
cout<<"hello world"<<end1;*/
cout << argv[1] << end1;
}


stupid.cpp: In function `int main(int, char**)':
stupid.cpp:7: `cout' undeclared (first use this function)
stupid.cpp:7: (Each undeclared identifier is reported only once for each
function it appears in.)
stupid.cpp:7: `end1' undeclared (first use this function)


Trial #2 :
---------
#include <iostream>
using namespace std;
int main() {
//std::cout<<"hello world"<<std::end1;
cout << "hello world" << end1;
}


stupid2.cpp: In function `int main()':
stupid2.cpp:5: `end1' undeclared (first use this function)
stupid2.cpp:5: (Each undeclared identifier is reported only once for each
function it appears in.)

Trial #3 :
---------
#include <iostream>
int main() {
std::cout << "hello world" <<std::end1;
}


stupid3.cpp: In function `int main()':
stupid3.cpp:3: `end1' undeclared in namespace `std'
 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      07-06-2003
"ehab" <(E-Mail Removed)> wrote...
> Here they are my trials : please judge I can not find where is error
>
> Trial #1 :
> ---------
> #include <iostream>
> /*using namespace std;
> int main() {*/
> int main(int argc, char **argv) {
> /*std::cout<<"hello world"<<std::end1;
> cout<<"hello world"<<end1;*/
> cout << argv[1] << end1;

^^^^
If I capitalise this, I will get END1. You need a lower-case
equivalent of ENDL. Do you see the difference?

> }
>
>
> stupid.cpp: In function `int main(int, char**)':
> stupid.cpp:7: `cout' undeclared (first use this function)
> stupid.cpp:7: (Each undeclared identifier is reported only once for each
> function it appears in.)
> stupid.cpp:7: `end1' undeclared (first use this function)
>
>
> Trial #2 :
> ---------
> #include <iostream>
> using namespace std;
> int main() {
> //std::cout<<"hello world"<<std::end1;
> cout << "hello world" << end1;
> }
>
>
> stupid2.cpp: In function `int main()':
> stupid2.cpp:5: `end1' undeclared (first use this function)
> stupid2.cpp:5: (Each undeclared identifier is reported only once for each
> function it appears in.)
>
> Trial #3 :
> ---------
> #include <iostream>
> int main() {
> std::cout << "hello world" <<std::end1;
> }
>
>
> stupid3.cpp: In function `int main()':
> stupid3.cpp:3: `end1' undeclared in namespace `std'


Yes, there is not end-ONE in 'std'. There is end-ELL and you should
use _it_ instead. Copy and paste "endl" (without the quotes) into
your program.

Victor


 
Reply With Quote
 
 
 
 
ehab
Guest
Posts: n/a
 
      07-07-2003
To whome adivces me to relace end1 by endl
I go the down erre .


#include <iostream>
int main() {
std::cout << "hello world" <<std::endl;
}


# g++ stupid3.cpp
# ./a*
ld.so.1: ./a.out: fatal: libstdc++.so.5: open failed: No such file or directory
Killed
#
 
Reply With Quote
 
Rolf Magnus
Guest
Posts: n/a
 
      07-07-2003
Again, your problem isn't about C, so please don't ignore the
followup-to again.

ehab wrote:

> Here they are my trials : please judge I can not find where is error
>
> Trial #1 :
> ---------
> #include <iostream>
> /*using namespace std;
> int main() {*/
> int main(int argc, char **argv) {
> /*std::cout<<"hello world"<<std::end1;
> cout<<"hello world"<<end1;*/
> cout << argv[1] << end1;
> }
>
>
> stupid.cpp: In function `int main(int, char**)':
> stupid.cpp:7: `cout' undeclared (first use this function)


cout is in namespace std. You commented out everything regarding that
namespace.

> stupid.cpp:7: (Each undeclared identifier is reported only once for
> each
> function it appears in.)
> stupid.cpp:7: `end1' undeclared (first use this function)


It's not end1, but endl.

> Trial #2 :
> ---------
> #include <iostream>
> using namespace std;
> int main() {
> //std::cout<<"hello world"<<std::end1;
> cout << "hello world" << end1;
> }
>
>
> stupid2.cpp: In function `int main()':
> stupid2.cpp:5: `end1' undeclared (first use this function)
> stupid2.cpp:5: (Each undeclared identifier is reported only once for
> each function it appears in.)


Again, not end1, but endl.

> Trial #3 :
> ---------
> #include <iostream>
> int main() {
> std::cout << "hello world" <<std::end1;
> }
>
>
> stupid3.cpp: In function `int main()':
> stupid3.cpp:3: `end1' undeclared in namespace `std'


Well...

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
std::cout vs cout Pmb C++ 2 06-02-2004 03:27 PM
Re: error while cout command compiling ehab C Programming 2 07-09-2003 01:28 AM
Re: error while cout command compiling ehab C++ 3 07-07-2003 10:49 AM
Re: error while cout command compiling ehab C Programming 1 07-07-2003 07:52 AM
man cout or info cout abi C++ 2 06-28-2003 06:42 PM



Advertisments