精華區beta EE_DSnP 關於我們 聯絡資訊
※ 引述《ric2k1 (Ric)》之銘言: : ※ 引述《moonjustin (快點放長假吧@@)》之銘言: : : 題目題是說會有linking的問題 : : 但我顯示出來的訊息是 : : Compiling: main.cpp : : Compiling: undef1.cpp : : g++ -c -o undef2.o undef2.C : : Compiling: undef2.o : : Achiving libundef2.a : : Linking undef : : 他似乎很順利的完成了聯結? : : 可是我Makefile檔案的部份都沒改? : Please note that in Prob 2 (a) --- : "...Don't fix them by declaring local variables." 謝謝老師 我那時候是以為 宣告在undef1.cpp裡面的f()函數裡才算local variable 所以我就把它宣告在函數外面 這樣寫之後link會沒問題應該是因為 我在indef1.cpp 裡面已經宣告int a; 而且在Makefile裡面 lib的連結原本就錯誤 所以它找不到另一個在lib裡面的int a 所以才會連結成功 總之謝謝了^^" -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.18.220