[buug] about static library error
george0873
crazylion at vip.sina.com
Tue Aug 17 22:01:15 PDT 2004
I wrote a audio library. I make a static library. The makefile as following:
///////////Makefile////////////
CC = gcc
AR = ar
OBJS = GWAbase.o GWAhandler.o
CFLAGS = -Wstrict-prototypes -Wall -Wunused -O3
COMPILE = $(CC)$(CLAGS) -c
SOURCE = GWAbase.cpp GWAhandler.cpp
HEADER = GWAbase.h GWAdefs.h GWAinc.h GWAhandler.h
TARGET = ./.lib/libgwa.a
$(TARGET): $(OBJS)
$(AR) r $(TARGET) $(OBJS)
$(OBJS): $(HEADER)
%.o:%.c
$(COMPILE) -o $@ $<
all: $(TARGET)
echo "The libgwa.a locate in .lib/"
clean:
rm -f $(OBJS) $(TARGET)
////////////End of the Makefile////////////////
I wrote a program to test the library. The program as following:
////////////record.cpp////////////////
#include "GWAdefs.h"
#include "GWAhandler.h"
int main( int argc, char** argv)
{
GWA8u buffer[4096];
GWAhandler gwa;
while(1) {
gwa.GetAudioInput( buffer, AFMT_S16_LE, 2, 8000 );
gwa.RecordIntoFile( buffer, "audio" );
}
}
/////////////End of file record.cpp///////////////////
The makefile is:
/////////////Makefile////////////////
CC = gcc
TARGET = record
OBJS = record.o
SRC = record.cpp
all: $(TARGET)
$(TARGET): $(OBJS)
$(CC) -o $(TARGET) $(OBJS) -L../GWAudiolib/.lib/ -lgwa
$(OBJS): $(SRC)
$(CC) -c $(SRC) -o $(OBJS) -I../GWAudiolib/
clean:
rm -f $(OBJS) $(TARGET)
/////////////End of the Makefile//////////////
While I make, error occurs
************************
gcc -c record.cpp -o record.o -I../GWAudiolib/
gcc -o record record.o -L../GWAudiolib/.lib/ -lgwa
record.o(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
../GWAudiolib/.lib//libgwa.a(GWAhandler.o)(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
../GWAudiolib/.lib//libgwa.a(GWAbase.o)(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
make: *** [record] Error 1
make: Target `all' not remade because of errors.
I don't understand, it is the fault of lib or program?
______________________________________
===================================================================
More information about the buug
mailing list