[問題] Linking .lib in DEV-C IDE and using …

看板C_and_CPP (C/C++)作者 (大神一郎)時間16年前 (2009/05/25 22:56), 編輯推噓1(104)
留言5則, 3人參與, 最新討論串1/1
由於需要在C code內使用external function 所以得link一個library file---libhmetis.lib (有linux版本的libhmetis.a) 下面一行是我在compiler option加入的指令 -L C:\debug_using -l libhmetis 到此為止都還沒有發生report error or warning 但就在我要使用library內的function時 出現了許多的message: variable '_iob' can't be auto-imported. Please read the documentation for ld's --enable-auto-import for details. .drectve `-defaultlib:LIBC ' unrecognized .drectve `-defaultlib:OLDNAMES ' unrecognized resolving __iob by linking to __imp___iob (auto-import) [Linker error] undefined reference to `_nm___iob' 以上這五種內 前三種出現數十次 想請問該如何修改才能正確連結並且使用library所提供的function呢? 已解決 改為link .a file Linker option 要加上: -L C:\debug_using -l hmetis gcc會自動加上library的檔名前面的lib 但是 現在問題變成要如何呼叫library裡面的function... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.195.63.169

05/26 00:06, , 1F
你該不會是拿 VC 的 library 想給 GCC 用吧?
05/26 00:06, 1F

05/26 00:20, , 2F
看起來似乎是這麼回事 但我不知道怎麼link .a file..
05/26 00:20, 2F
※ 編輯: OgamiIchiro 來自: 123.195.63.169 (05/26 02:34) ※ 編輯: OgamiIchiro 來自: 123.195.63.169 (05/26 03:44)

05/26 09:52, , 3F
不是直接呼叫就好了?
05/26 09:52, 3F

05/26 19:48, , 4F
我有試過不宣告prototype直接呼叫 依然是同樣的error
05/26 19:48, 4F

05/26 19:49, , 5F
不確定是不是因為沒有在工作站上面用造成的
05/26 19:49, 5F
文章代碼(AID): #1A6h6l7t (C_and_CPP)
文章代碼(AID): #1A6h6l7t (C_and_CPP)