[問題] linux complier c++ string

看板Linux作者 (None)時間16年前 (2009/03/26 15:46), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/1
※ [本文轉錄自 C_and_CPP 看板] 作者: b60413 (None) 看板: C_and_CPP 標題: [問題] linux complier c++ string 時間: Thu Mar 26 15:40:52 2009 今天我嘗試在linux上編譯自己寫的一小段程式碼 結果編譯一直錯誤並且顯示"錯誤:「string」 沒有命名一個類型" 我查了google以後 他說可能是沒有include string.h這個標頭 於是我又去修改我的程式碼並且加入string.h這個標頭檔 但是還是一直無法使用....不知道到底是哪裡有寫錯.... 還請版友幫忙糾正一下 謝謝 //A.cpp 這是一個測試用的class #include <iostream> #include <string> #include "A.h" using namespace std; A::A() { cout<<"call constructor"<<endl; a="aa"; } //main.cpp 這是主要的程式碼片段 #include <iostream> #include <string> #include "A.h" using namespace std; int main() { A b; return 0; } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.195.217.195 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 123.195.217.195

03/26 17:28, , 1F
編譯的錯誤訊息應該一起貼出來
03/26 17:28, 1F

03/26 18:07, , 2F
where A.h? #include<string.h> ?
03/26 18:07, 2F
文章代碼(AID): #19opBnJV (Linux)