error running hello world

Discussion in 'C++' started by Gary Wessle, Jul 19, 2006.

  1. Gary Wessle

    Gary Wessle Guest

    thanks for helping with this problem

    I am getting errors starting with

    fred@debian:~/myPrograms/cpp/practice$ make
    cc hello.cpp
    /tmp/ccQzQfGH.o: In function `main':
    hello.cpp:(.text+0x27): undefined reference to `std::cout'

    **************** the program ****************
    #include <iostream>
    using namespace std;

    int main() {
    cout << "Hello, World! I am "
    << 8 << " Today!" << endl;
    return 0;
    }
    ************************************************

    **************** the make file ****************
    hello: hello.o
    cc hello.cpp
    ***********************************************
    Gary Wessle, Jul 19, 2006
    #1
    1. Advertising

  2. Gary Wessle

    Ian Collins Guest

    Gary Wessle wrote:
    > thanks for helping with this problem
    >
    > I am getting errors starting with
    >
    > fred@debian:~/myPrograms/cpp/practice$ make
    > cc hello.cpp
    > /tmp/ccQzQfGH.o: In function `main':
    > hello.cpp:(.text+0x27): undefined reference to `std::cout'
    >

    Try compiling it with a C++ compiler rather an a C compiler.

    --
    Ian Collins.
    Ian Collins, Jul 19, 2006
    #2
    1. Advertising

  3. Gary Wessle

    Gary Wessle Guest

    Ian Collins <> writes:

    > Gary Wessle wrote:
    > > thanks for helping with this problem
    > >
    > > I am getting errors starting with
    > >
    > > fred@debian:~/myPrograms/cpp/practice$ make
    > > cc hello.cpp
    > > /tmp/ccQzQfGH.o: In function `main':
    > > hello.cpp:(.text+0x27): undefined reference to `std::cout'
    > >

    > Try compiling it with a C++ compiler rather an a C compiler.
    >
    > --
    > Ian Collins.


    thanks
    it now compiles but when I run it

    ****************************************************************
    fred@debian:~/myPrograms/cpp/practice$ ls
    a.out hello.cpp hello.o makefile semantic.cache
    fred@debian:~/myPrograms/cpp/practice$ a.out
    bash: a.out: command not found
    ****************************************************************
    Gary Wessle, Jul 19, 2006
    #3
  4. Gary Wessle schrieb:
    > Ian Collins <> writes:
    >
    >> Gary Wessle wrote:
    >>> thanks for helping with this problem
    >>>
    >>> I am getting errors starting with
    >>>
    >>> fred@debian:~/myPrograms/cpp/practice$ make
    >>> cc hello.cpp
    >>> /tmp/ccQzQfGH.o: In function `main':
    >>> hello.cpp:(.text+0x27): undefined reference to `std::cout'
    >>>

    >> Try compiling it with a C++ compiler rather an a C compiler.
    >>
    >> --
    >> Ian Collins.

    >
    > thanks
    > it now compiles but when I run it
    >
    > ****************************************************************
    > fred@debian:~/myPrograms/cpp/practice$ ls
    > a.out hello.cpp hello.o makefile semantic.cache
    > fred@debian:~/myPrograms/cpp/practice$ a.out
    > bash: a.out: command not found
    > ****************************************************************


    The current directory (called ".") is not in your path.

    Try:
    ../a.out

    Well, tools and operation systems are offtopic here.
    You need to read a good book about Linux.

    --
    Thomas
    Thomas J. Gritzan, Jul 19, 2006
    #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. vijay
    Replies:
    8
    Views:
    692
  2. Roy
    Replies:
    6
    Views:
    582
    Roedy Green
    Jan 7, 2008
  3. Hongyu
    Replies:
    16
    Views:
    662
    mail oo
    Aug 6, 2008
  4. JC

    Running Hello World function - security warning

    JC, Jan 15, 2009, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    673
  5. Larry
    Replies:
    27
    Views:
    413
    Michele Dondi
    Jan 25, 2005
Loading...

Share This Page