im trying to get jam to compile and link this
#include "a.h"
int main()
{
A::Foo();
}
#ifndef A_H
#define A_H
/***/
class A
{
public:
/***/
A();
/***/
A(const A &a);
/***/
~A();
/***/
void operator=(const A &a);
static void Foo();
private:
};
#endif
#include "a.h"
#include <iostream>
A::A()
{
}
A::A(const A &a)
{
operator=(A);
}
A::~A()
{
}
void A::operator=(const A &a)
{
}
void A::Foo()
{
std::cout << "Foo()\n";
}
C++ = g++ ;
Main amir : main.cpp a.cpp ;
and the output
genjix@linux:~/media/tmp/src> jam
...found 14 target(s)...
...updating 1 target(s)...
Link amir
main.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
a.o(.text+0x56): In function `A::Foo()':
: undefined reference to `std::cout'
a.o(.text+0x5b): In function `A::Foo()':
: 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*)'
a.o(.text+0x88): In function `__static_initialization_and_destruction_0(int,int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
a.o(.text+0xb2): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
a.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
cc -o amir main.o a.o
...failed Link amir ...
...failed updating 1 target(s)...
whereas
genjix@linux:~/media/tmp/src> g++ -c a.cpp
genjix@linux:~/media/tmp/src> g++ -c main.cpp
genjix@linux:~/media/tmp/src> g++ main.o a.o
genjix@linux:~/media/tmp/src> ./a.out
is fine.
thanks.