[問題] static函數無法用template嗎

看板C_and_CPP (C/C++)作者 (su27)時間5年前 (2020/02/27 15:41), 5年前編輯推噓1(102)
留言3則, 3人參與, 5年前最新討論串1/1
開發平台(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

02/27 15:54, 5年前 , 1F
你把函式定義拆到header外面去了吧?
02/27 15:54, 1F
沒錯 ※ 編輯: su27 (220.135.141.239 臺灣), 02/27/2020 16:02:48 不拆開就能正常使用了 ※ 編輯: su27 (220.135.141.239 臺灣), 02/27/2020 16:13:50

02/28 00:05, 5年前 , 2F
你知道你想做什麼嗎
02/28 00:05, 2F

03/02 18:22, 5年前 , 3F
你知道c++的static含義嗎?
03/02 18:22, 3F
文章代碼(AID): #1ULtA_E6 (C_and_CPP)
文章代碼(AID): #1ULtA_E6 (C_and_CPP)