tags:

views:

135

answers:

1

The Makefile is as follows:

.PHONY: all clean

all : backtrace.dll test.exe

backtrace.dll : backtrace.c
    gcc -O2 -shared -Wall -o $@ $^ -lbfd -liberty -limagehlp --verbose

test.exe : test.c
    gcc -g -Wall -o $@ $^

clean :
    -del -f backtrace.dll test.exe

The source code backtrace.c is a library that allows you to obtain a stack trace in C. The details are on google code: http://code.google.com/p/backtrace-mingw/

When I using the command:

mingw32-make

I get the error message:

gcc -O2 -shared -Wall -o backtrace.dll backtrace.c -lbfd -liberty -limagehlp
C:/MinGW/lib/libbfd.a(libbfd.o):libbfd.c:(.text+0x6ee)锛氬鈥榣ibintl_dgettext
鈥欐湭瀹氫箟鐨勫紩鐢
C:/MinGW/lib/libbfd.a(libbfd.o):libbfd.c:(.text+0x740)锛氬鈥榣ibintl_dgettext
鈥欐湭瀹氫箟鐨勫紩鐢
C:/MinGW/lib/libbfd.a(libbfd.o):libbfd.c:(.text+0x79b)锛氬鈥榣ibintl_dgettext
鈥欐湭瀹氫箟鐨勫紩鐢
C:/MinGW/lib/libbfd.a(libbfd.o):libbfd.c:(.text+0x7d0)锛氬鈥榣ibintl_dgettext
鈥欐湭瀹氫箟鐨勫紩鐢
C:/MinGW/lib/libbfd.a(bfd.o):bfd.c:(.text+0x8fd)锛氬鈥榣ibintl_dgettext鈥欐湭
瀹氫箟鐨勫紩鐢
C:/MinGW/lib/libbfd.a(bfd.o):bfd.c:(.text+0x964): more undefined references to `
libintl_dgettext' follow
collect2: ld returned 1 exit status
mingw32-make: *** [backtrace.dll] Error 1

How can I fix this error?

A: 

You must add a reference to the libintl library, so that your link line becomes:

gcc -O2 -shared -Wall -o $@ $^ -lbfd -liberty -limagehlp -lintl --verbose
André Wagner