Kind of a newbi question about gcc (I think)

Discussion in 'Linux - General discussion' started by Venaqua, Jun 19, 2008.

Thread Status:
Not open for further replies.
  1. Venaqua

    Venaqua Member

    Joined:
    Apr 13, 2008
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    11
    So I switch from Windows to Ubuntu about a month or two ago and I thought it would make sense to learn some programing so I'm trying to learn C++ and, of course my first program is a Hello World one named Hello.cpp. The book I'm learning from says to type at the command prompt ~$cc Hello.cpp to compile it in MS-DOS.

    So what I need to know is, for Linux would I type ~$gcc Hello.cpp. If not then what should I type and if so then why does this happen.

    In file included from /usr/include/c++/4.2/backward/iostream.h:31,
    from Hello.cpp:1:
    /usr/include/c++/4.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
    /tmp/ccsOXpwT.o: In function `std::__verify_grouping(char const*, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
    Hello.cpp:(.text+0xe): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const'
    Hello.cpp:(.text+0x59): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::eek:perator[](unsigned int) const'
    Hello.cpp:(.text+0x97): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::eek:perator[](unsigned int) const'
    Hello.cpp:(.text+0xdf): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::eek:perator[](unsigned int) const'
    /tmp/ccsOXpwT.o: In function `main':
    Hello.cpp:(.text+0x128): undefined reference to `std::cout'
    Hello.cpp:(.text+0x12d): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::eek:perator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
    /tmp/ccsOXpwT.o: In function `__static_initialization_and_destruction_0(int, int)':
    Hello.cpp:(.text+0x15d): undefined reference to `std::ios_base::Init::Init()'
    /tmp/ccsOXpwT.o: In function `__tcf_0':
    Hello.cpp:(.text+0x1aa): undefined reference to `std::ios_base::Init::~Init()'
    /tmp/ccsOXpwT.o:(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
    collect2: ld returned 1 exit status

    After this happens I don't get a program or any thing else.Could somebody please tell me what this means.
    Also heres the program in case I made A mistake there (tho I don't think I did).

    #include <iostream.h>

    int main ()
    {
    cout<<"Hello, World\n";
    return 0;
    }

    If somebody could help me I would really appreciate.
     
  2. Venaqua

    Venaqua Member

    Joined:
    Apr 13, 2008
    Messages:
    28
    Likes Received:
    0
    Trophy Points:
    11
    Oops I didn't mean to make a second thread about this.

    Can someone close this one.
     
Thread Status:
Not open for further replies.

Share This Page