看板 C_and_CPP 關於我們 聯絡資訊
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) Linux 問題(Question): c++出現編譯錯誤 不確定是否是thread建立時的問題。 預期的正確結果(Expected Output): 輸入兩個數字,一個表示thread數量,一個表示要產生的隨機數字的個數 分配給不同thread加起來,印出每個thread的和以及main thread的和 錯誤結果(Wrong Output): http://i.imgur.com/tLCxwD3.jpg 程式碼(Code):(請善用置底文網頁, 記得排版) http://cpp.sh/6ioo6 補充說明(Supplement): 看不太懂編譯結果,求解QQ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.115.206.37 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1459487261.A.F05.html ※ 編輯: jackyT (140.115.206.37), 04/01/2016 13:22:39
yyan1218: 用g++ -m64 thread.cpp.......... 試試看? 04/01 14:10
yyan1218: 或g++ -m32 thread.cpp... 04/01 14:14
m64結果一樣 m32變成http://i.imgur.com/tC7Kq1t.jpg 不知道是什麼問題Orz ※ 編輯: jackyT (140.115.206.37), 04/01/2016 14:21:06
Caesar08: string不能拿來跟int做相加 04/01 15:02
感謝C大 已解決<(_ _)>
shadow0326: 用g++不要用gcc吧 用gcc去編譯c++程式要考慮一堆link 04/01 15:08
感謝 g++編譯成功惹 ※ 編輯: jackyT (140.115.206.37), 04/01/2016 15:27:28 ※ 編輯: jackyT (140.115.206.37), 04/01/2016 15:31:52