linux-mips
[Top] [All Lists]

compile C++ code

To: <linux-mips@oss.sgi.com>
Subject: compile C++ code
From: "kjlin" <kj.lin@viditec-netmedia.com.tw>
Date: Fri, 31 Aug 2001 18:01:51 +0800
Sender: owner-linux-mips@oss.sgi.com
Hi all,
 
My host is x86 with redhat 7.0 and install the mips cross-compiler:
1.binutils-mips-linux-2.8.1-2.i386.rpm
2.egcs-mips-linux-1.1.2-3.i386.rpm
3.egcs-c++-mips-linux-1.1.2-4.i386.rpm
4.libc-2.0.6
5.egcs-libstdc++-mips-linux-2.9.0-4.i386.rpm
But when i compile the following C++ code, something wrong!
 
#include <stdio.h>
class A {
public:
        A();
        virtual void hello();        // with virtual is failed, without virtual is ok.
};
A::A() {printf("A construction!\n");}
void A::hello() { printf("hello\n"); }
main()
{
        A *exam;
        exam->hello();
}
#mips-linux-gcc test.C
/usr/lib/gcc-lib/mips-linux/egcs-2.91.66/libgcc.a(frame.o): In function `decode_uleb128':
/usr/src/redhat/BUILD/egcs-1.1.2/target-mips-linux/gcc/../../gcc/frame.c(.data+0x0): undefined reference to `pthread_create'
/usr/mips-linux/bin/ld: bfd assertion fail ../../bfd/elf32-mips.c:5123
mips-linux-gcc: Internal compiler error: program ld got fatal signal 11
#mips-linux-g++ test.C
/usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_create'
/usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_getspecific'
/usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_once'
/usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_key_create'
/usr/mips-linux/lib/libstdc++.so: undefined reference to `pthread_setspecific'
If the "virtual" is not used, "virtual void hello();" to "void hello();", mips-linux-gcc compiling is fine but mips-linux-g++ compiling is still the same error.
What is going on?
Is it the problem of compiler or library?
How should i do?
 
Thanks in advance!
KJ
 
<Prev in Thread] Current Thread [Next in Thread>