Kan ikke koere Hello world
Naar jeg proever at koere dette helt basis Hello world program faar jeg foelgende fejl.ae.cc
// Mit første C++ program
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World!";
return 0;
}
Jeg linker og compiler det med:
gcc -c ae.cc -o ae.obj
gcc ae.obj -o myProg
./myProg
Jeg faar foelgende fejl
./ae.sh
ae.obj(.text+0xd): In function `std::__verify_grouping(char const*, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const'
ae.obj(.text+0x60): In function `std::__verify_grouping(char const*, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned int) const'
ae.obj(.text+0x9d): In function `std::__verify_grouping(char const*, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned int) const'
ae.obj(.text+0xc8): In function `std::__verify_grouping(char const*, unsigned int, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
: undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned int) const'
ae.obj(.text+0x121): In function `main':
: undefined reference to `std::cout'
ae.obj(.text+0x126): 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*)'
ae.obj(.text+0x152): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init()'
ae.obj(.text+0x181): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init()'
ae.obj(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
./ae.sh: line 3: ./myProg: No such file or directory
Der maa da vaere et eller andet helt fundamentalt galt...