View Single Post
  #1   (View Single Post)  
Old 19th May 2008
Johnny2Bad Johnny2Bad is offline
Port Guard
 
Join Date: May 2008
Posts: 21
Exclamation Why wont this compile?

Hi,
Well over the past few weeks this newbie has been very impressed over FreeBSD and wonders why he wasted years with M$ products. Your support has been wonderfull and the O/S rocks.

However being a programmer at heart I wanted to check out gcc++. So I made a file Hello.cpp

Code:
#include <iostream>

int main()
{
    cout << "Hello World\n";

    return 0;
}
the simplest program I could think of, which when compiled gives me...

Code:
/var/tmp//ccPEm5DG.o(.text+0x1e): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
: undefined reference to `std::string::size() const'
/var/tmp//ccPEm5DG.o(.text+0x69): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
: undefined reference to `std::string::operator[](unsigned int) const'
/var/tmp//ccPEm5DG.o(.text+0xa7): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
: undefined reference to `std::string::operator[](unsigned int) const'
/var/tmp//ccPEm5DG.o(.text+0xef): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
: undefined reference to `std::string::operator[](unsigned int) const'
/var/tmp//ccPEm5DG.o(.text+0x13c): In function `main':
: undefined reference to `std::cout'
/var/tmp//ccPEm5DG.o(.text+0x141): In function `main':
: undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
/var/tmp//ccPEm5DG.o(.text+0x17d): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init()'
/var/tmp//ccPEm5DG.o(.text+0x1ce): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init()'
/var/tmp//ccPEm5DG.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
$ /var/tmp//ccPEm5DG.o(.text+0x1e): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
: undefined reference to `std::string::size() const'
/var/tmp//ccPEm5DG.o(.text+0x69): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
: undefined reference to `std::string::operator[](unsigned int) const'
Syntax error: word unexpected (expecting ")")
/var/tmp//ccPEm5DG.o(.text+0xa7): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
$ : undefined reference to `std::string::size() const'
/var/tmp//ccPEm5DG.o(.text+0x69): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
: undefined reference to `std::string::operator[](unsigned int) const'
/var/tmp//ccPEm5DG.o(.text+0xa7): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
: undefined reference to `std::string::operator[](unsigned int) const'
/var/tmp//ccPEm5DG.o(.text+0xef): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
> /var/tmp//ccPEm5DG.o(.text+0x69): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
Syntax error: "(" unexpected
$ : undefined reference to `std::string::operator[](unsigned int) const'
> /var/tmp//ccPEm5DG.o(.text+0xa7): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
Syntax error: word unexpected (expecting ")")
Syntax error: word unexpected (expecting ")")
$ : undefined reference to `std::string::operator[](unsigned int) const'
> /var/tmp//ccPEm5DG.o(.text+0xef): In function `std::__verify_grouping(char const*, unsigned int, std::string const&)':
Syntax error: word unexpected (expecting ")")
Syntax error: word unexpected (expecting ")")
$ : undefined reference to `std::string::operator[](unsigned int) const'
> /var/tmp//ccPEm5DG.o(.text+0x13c): In function `main':
Syntax error: word unexpected (expecting ")")
> : undefined reference to `std::cout'
main:
: undefined reference to `std::cout: not found
$ /var/tmp//ccPEm5DG.o(.text+0x141): In function `main':
Syntax error: word unexpected (expecting ")")
$ : undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
> /var/tmp//ccPEm5DG.o(.text+0x17d): In function `__static_initialization_and_destruction_0(int, int)':
Syntax error: redirection unexpected
Syntax error: word unexpected (expecting ")")
$ : undefined reference to `std::ios_base::Init::Init()'
> /var/tmp//ccPEm5DG.o(.text+0x1ce): In function `__tcf_0':
> : undefined reference to `std::ios_base::Init::~Init()'
$ /var/tmp//ccPEm5DG.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
Can anyone explain why this is not working? Perhaps I should be posting this to a programming forum, however it is so simple I thought you guys would pickup where I was going wrong in seconds.

Thanking you in advance,
Jonathan.
Reply With Quote