作者zxtow (该睡了...眠吧)
看板C_and_CPP
标题[问题] gcc link .lib 的问题(已爬文)
时间Thu Nov 19 03:57:57 2009
遇到的问题: (题意请描述清楚)
小弟目前手边有一个由 Voiceage 所提供的 AMR library,
在他的公司网站可以下载得到
http://www.voiceage.com/media/AMR-NB.zip
里面有包含 .lib .h 及 范例档
希望能於自己的程式中引用他所提供的 encoder/decoder 函式
但由於是 .lib 档,所以不知如何引用
有尝试过 reimp 及 dlltool 试图将其转为 .def 、 .dll
但由 reimp 转出来的档案不正确(非 .def 档)
希望得到的正确结果:
能够正确的 link AMR library
程式跑出来的错误结果:
Info: resolving __iob by linking to __imp___iob (auto-import)
Warning: .drectve `-defaultlib:LIBC ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:LIBC ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:LIBC ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
Warning: .drectve `-defaultlib:LIBC ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
../../Voiceage_AMR-NB//AMR-NB.lib(./Release/sp_enc.obj):C:\Claude\Data\3GP:(.text[_code_2i40_9bits]+0x6):
undefined reference to `_chkstk'
../../Voiceage_AMR-NB//AMR-NB.lib(./Release/sp_enc.obj):C:\Claude\Data\3GP:(.text[_code_2i40_11bits]+0x6):
undefined reference to `_chkstk'
../../Voiceage_AMR-NB//AMR-NB.lib(./Release/sp_enc.obj):C:\Claude\Data\3GP:(.text[_code_3i40_14bits]+0x6):
undefined reference to `_chkstk'
../../Voiceage_AMR-NB//AMR-NB.lib(./Release/sp_enc.obj):C:\Claude\Data\3GP:(.text[_code_4i40_17bits]+0x6):
undefined reference to `_chkstk'
../../Voiceage_AMR-NB//AMR-NB.lib(./Release/sp_enc.obj):C:\Claude\Data\3GP:(.text[_code_8i40_31bits]+0x6):
undefined reference to `_chkstk'
../../Voiceage_AMR-NB//AMR-NB.lib(./Release/sp_enc.obj):C:\Claude\Data\3GP:(.text[_code_10i40_35bits]+0x6):
more undefined references to `_chkstk' follow
fu000001.o:(.idata$2+0xc): undefined reference to `libmsvcrt_a_iname'
fu000004.o:(.idata$2+0xc): undefined reference to `libmsvcrt_a_iname'
fu000006.o:(.idata$2+0xc): undefined reference to `libmsvcrt_a_iname'
fu000008.o:(.idata$2+0xc): undefined reference to `libmsvcrt_a_iname'
fu000010.o:(.idata$2+0xc): undefined reference to `libmsvcrt_a_iname'
fu000012.o:(.idata$2+0xc): more undefined references to `libmsvcrt_a_iname'
follow
nmth000000.o:(.idata$4+0x0): undefined reference to `_nm___iob'
collect2: ld returned 1 exit status
make: *** [waveMaker.exe] Error 1
开发平台: (例: VC++ or gcc/g++ or Dev-C++, Windows or Linux)
mingw+gcc 3.4.5
有问题的code: (请善用置底文标色功能)
Library 名称/位置:
Voiceage_AMR-NB/AMR-NB.lib
於 makefile 中:
-L"Voiceage_AMR-NB/" -lAMR-NB
补充说明:
有尝试过 reimp 及 dlltool 试图将其转为 .def 、 .dll
但由 reimp 转出来的档案不正确(非 .def 档)
恳求各路大神解答 m(_ _)m
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.224.51.65
1F:→ weiyucsie:我只知道gcc的lib格式档名为lib[名称].a 11/19 14:40
2F:→ weiyucsie:.lib是不是visual c++用的? 11/19 14:42
3F:→ tinlans:VC 应该是加入 dependencies 吧,印象中没有很明确写成 11/19 15:54
4F:→ tinlans:static link 的栏位。 11/19 15:54
5F:→ tinlans:而且一看到 libmscvrt 就会联想到 MS VC Runtime,你用其 11/19 15:55
6F:→ tinlans:它的编译环境应该还要多 link 什麽才对,而且不晓得 11/19 15:56
7F:→ tinlans:calling convention 有没有通。 11/19 15:56
8F:→ tinlans:我没在 win 上写程式,只能猜到这样。 11/19 15:57
9F:→ zxtow:看起来好像除了用VC外 没有特别的方法...? 11/19 23:43
10F:→ zxtow:还是谢谢楼上们的指教 :) 11/19 23:43