程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> graph-matlab進行mex時出現 error LNK2019: 無法解析的外部符號……

graph-matlab進行mex時出現 error LNK2019: 無法解析的外部符號……

編輯:編程綜合問答
matlab進行mex時出現 error LNK2019: 無法解析的外部符號……
  **具體問題是:我想把現有的.cpp文件轉成.mexw32的文件,代碼沒有出現錯誤,因為前輩曾轉出過64位的。**

而且配置應該沒問題,因為mex代碼中其他.cpp文件是可以做出來的,唯獨這個出現以下錯誤:
mex mex_maxflow.cpp
正在創建庫 C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_4W~1\templib.x 和對象 C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\MEX_4W~1\templib.exp
mex_maxflow.obj : error LNK2019: 無法解析的外部符號 "public: thiscall Graph::~Graph(void)" (??1?$Graph@NNN@@QAE@XZ),該符號在函數 "public: void * __thiscall Graph::`scalar deleting destructor'(unsigned int)" (??_G?$Graph@NNN@@QAEPAXI@Z) 中被引用
mex_maxflow.obj : error LNK2019: 無法解析的外部符號 "private: void __thiscall Graph::reallocate_nodes(int)" (?reallocate_nodes@?$Graph@NNN@@AAEXH@Z),該符號在函數 "public: int __thiscall Graph::add_node(int)" (?add_node@?$Graph@NNN@@QAEHH@Z) 中被引用
mex_maxflow.obj : error LNK2019: 無法解析的外部符號 "private: void __thiscall Graph::reallocate_arcs(void)" (?reallocate_arcs@?$Graph@NNN@@AAEXXZ),該符號在函數 "public: void __thiscall Graph::add_edge(int,int,double,double)" (?add_edge@?$Graph@NNN@@QAEXHHNN@Z) 中被引用
mex_maxflow.obj : error LNK2019: 無法解析的外部符號 "public: double __thiscall Graph::maxflow(bool,class Block *)" (?maxflow@?$Graph@NNN@@QAEN_NPAV?$Block@H@@@Z),該符號在函數 _mexFunction 中被引用
mex_maxflow.obj : error LNK2019: 無法解析的外部符號 "public: __thiscall Graph::Graph(int,int,void (
cdecl*)(char *))" (??0?$Graph@NNN@@QAE@HHP6AXPAD@Z@Z),該符號在函數 _mexFunction 中被引用
mex_maxflow.mexw32 : fatal error LNK1120: 5 個無法解析的外部命令

E:\MATLAB~3\BIN\MEX.PL: Error: Link of 'mex_maxflow.mexw32' failed.

折騰好久了也沒結果,我試著更改文件名也存在錯誤,查了很多資料有些用vs編譯的說是.lib調用問題,不過感覺和matlab進行mex是兩回事麼?好像是編譯的文件引用了mexFuntion中文件,就是上面錯誤中說到的。請大家幫忙分析一下,不勝感激。僅有的1c幣奉上

最佳回答:


應該是你當前的cpp有用其他cpp中實現的類,函數等,造成link的時候找不到實現。
你可以把用到的其他cpp文件中的實現復制一份到當前cpp。再編譯。

wangwei19900806
wangwei19900806
wangwei19900806
wangwei19900806
wangwei19900806
wangwei19900806
wangwei19900806
wangwei19900806
wangwei19900806
wangwei19900806
wangwei19900806
wangwei19900806
wangwei19900806
a1075863454
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved