[問題] template with C linkage - string

看板C_and_CPP作者 (JIM)時間9年前 (2015/02/11 18:33), 9年前編輯推噓0(002)
留言2則, 2人參與, 最新討論串1/1
請教各位大大~~ 編譯環境是在Linux上使用gcc 在一個前提可以正常執行的程式上 在header檔裡面多加了 >>#include <string> >>int fun1(std::string); 編譯下去會發生一堆的 >>/usr/include/c++/4.6/bits/basic_string.tcc:979:3: error: template with C linkage 這種錯誤 請問有遇過類似問題的大大可以給的明燈嗎~ 謝啦 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.123.112.60 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1423650838.A.3E3.html

02/11 19:10, , 1F
是不是不小心包在 extern C 裏面了
02/11 19:10, 1F

02/11 19:32, , 2F
<String> 是啥?
02/11 19:32, 2F
我把這些拉出extern C外就可以了! 謝謝兩位!!!! ※ 編輯: jiqian (140.123.112.60), 02/11/2015 21:00:33
文章代碼(AID): #1Ksp0MFZ (C_and_CPP)