看板 EE_DSnP 關於我們 聯絡資訊
不知道是不是版本的問題。我是 gcc 4.1.2。 spock@localhost /home/spock/dsnphw/hw1.2 $ g++ -g –Wall –o hw1.2.p1 hw1.2.p1.cpp g++: –Wall:沒有此一檔案或目錄 g++: –o:沒有此一檔案或目錄 g++: hw1.2.p1:沒有此一檔案或目錄 hw1.2.p1.cpp: In function 「int& f(int)」: hw1.2.p1.cpp:3: 警告:回傳了對局部變數的 「i」 的參照 Exit 1 老師的解答在推文裡 orz -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.137.116.165
ric2k1:I tried g++ 4.1.1, and it is OK. 03/06 22:18
ric2k1:Please double check your '-' in your command line. 03/06 22:18
ric2k1:If you copy the command option directly from M$ Word, 03/06 22:19
ric2k1:there seems to be problem for the '-' sign. 03/06 22:19
ric2k1:It becomes 亂碼. Please try again. 03/06 22:19
ric2k1:Anyway, -g, -o, -Wall 應該是 very common options, 03/06 22:20
ric2k1:g++ 不太可能會改這個, 否則天下會大亂了~~~ 03/06 22:20
ric2k1:請是這用打的, 而不是 copy and paste... 03/06 22:21
ric2k1: 試著 03/06 22:22
spock:老師你完全正確,對不起 orz 03/06 22:27
※ 編輯: spock 來自: 220.137.116.165 (03/06 22:29)
ric2k1:沒關係, 讓你白花了許多時間, 怪 M$ 好了 XD 03/06 23:08
spock:我用 Word 的時候也很討厭它喜歡亂換我的 - orz 03/06 23:53