Re: error while cout command compiling

Discussion in 'C++' started by ehab, Jul 6, 2003.

  1. ehab

    ehab Guest

    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'
    ehab, Jul 6, 2003
    #1
    1. Advertising

  2. "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;

    ^^^^
    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
    Victor Bazarov, Jul 6, 2003
    #2
    1. Advertising

  3. ehab

    ehab Guest

    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
    #
    ehab, Jul 7, 2003
    #3
  4. ehab

    Rolf Magnus Guest

    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...
    Rolf Magnus, Jul 7, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. abi

    man cout or info cout

    abi, Jun 27, 2003, in forum: C++
    Replies:
    2
    Views:
    1,647
  2. Pmb

    std::cout vs cout

    Pmb, Jun 2, 2004, in forum: C++
    Replies:
    2
    Views:
    4,404
    Leor Zolman
    Jun 2, 2004
  3. ehab

    Re: error while cout command compiling

    ehab, Jul 6, 2003, in forum: C Programming
    Replies:
    3
    Views:
    5,189
    Rolf Magnus
    Jul 7, 2003
  4. ehab

    Re: error while cout command compiling

    ehab, Jul 7, 2003, in forum: C Programming
    Replies:
    1
    Views:
    336
    =?iso-8859-1?Q?Andr=E9_P=F6nitz?=
    Jul 7, 2003
  5. ehab

    Re: error while cout command compiling

    ehab, Jul 7, 2003, in forum: C Programming
    Replies:
    2
    Views:
    284
    Dave Steffen
    Jul 9, 2003
Loading...

Share This Page