[問題] Xcode開發C++如何連接C++ shared object
抱歉小弟是Xcode和C++的新手,初在此板發文,麻煩各位大大鞭小力一點 >"<
我現在手邊有一個.so檔,
透過nm反編譯找到一些function想要使用看看,
我已經在Build Phrases -> Link Binary with Libraries 加入了該so檔,
似乎還是沒辦法讓我的C++ project找到,
我也沒有相關的header檔,
想問看看各位大大的看法~
邏輯上不正確之處請多指正謝謝~!
--
推
10/11 21:45,
10/11 21:45
→
10/11 21:46,
10/11 21:46
→
10/11 21:46,
10/11 21:46
→
,
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.24.189.173
※ 文章網址: https://www.ptt.cc/bbs/MacDev/M.1517924606.A.7B2.html
→
02/07 01:18,
7年前
, 1F
02/07 01:18, 1F
→
02/07 22:43,
7年前
, 2F
02/07 22:43, 2F
推
02/09 12:53,
7年前
, 3F
02/09 12:53, 3F
→
02/09 12:58,
7年前
, 4F
02/09 12:58, 4F
→
02/09 12:59,
7年前
, 5F
02/09 12:59, 5F
後來我是找到可以用dlopen和dlsym去動態load shared object,
結果出現error
Cannot load library: dlopen(/usr/lib64/libtest.so, 1): no suitable image found. Did find:
/usr/lib64/libtest.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
/usr/lib64/libtest.so: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
Program ended with exit code: 1
上網參考 https://stackoverflow.com/questions/1924452/what-can-cause-dlopen-no-suitable-image-found-cant-map
看起來是shared object格式Mac OS認不出來,
後來換成用VM去開一個CentOS出來就編的過了,
目前是卡在執行時dlopen會跑出segmentation fault.....
※ 編輯: antirazin (114.24.151.163), 02/12/2018 00:24:24
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章