在 Windows 7 中使用 MinGW 编译 C 代码时出错
Makefile 如下:
.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
源代码 backtrace.c
是一个库,可让您获取 C 语言的堆栈跟踪。详细信息请参阅 google code:http://code.google.com/p/backtrace-mingw/
当我使用该命令时:
mingw32-make
我收到错误消息:
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
我该如何修复这个错误?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须添加对 libintl 库的引用,以便您的链接行变为:
You must add a reference to the libintl library, so that your link line becomes: