作者su27 (su27)
看板C_and_CPP
標題[問題] static函數無法用template嗎
時間Thu Feb 27 15:41:48 2020
開發平台(Platform): (Ex: Win10, Linux, ...)
win10
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
vs2017
問題一
程式碼如下
我寫一個類別 其中一個函數使用靜態函數 功能正常
後來加入 template<class typeA> 編譯時會顯示"無法解析的外部符號...."
請問這有解嗎
該怎麼改才能編譯成功
謝謝
class Operator_Class_Func
{
public:
template<class typeA>
static int Get_Region_(Mat & src_image, Mat & dest_image, vector<Point> & vtp);
};
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.135.141.239 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1582789311.A.386.html
→ sarafciel: 你把函式定義拆到header外面去了吧? 02/27 15:54
沒錯
※ 編輯: su27 (220.135.141.239 臺灣), 02/27/2020 16:02:48
不拆開就能正常使用了
※ 編輯: su27 (220.135.141.239 臺灣), 02/27/2020 16:13:50
→ Jockey66666: 你知道你想做什麼嗎 02/28 00:05
推 suspect1: 你知道c++的static含義嗎? 03/02 18:22