[問題] warning:file built for unsupported format

看板C_and_CPP作者 (免洗)時間9年前 (2015/02/10 12:28), 編輯推噓2(2010)
留言12則, 3人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) gcc on mac 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): 在嘗試用the c++ stl 2nd上面的範例 餵入的資料(Input): 預期的正確結果(Expected Output): 沒有warning 已經會出現結果 錯誤結果(Wrong Output): 編譯時會出現 g++ -std=c++11 -c tuple2.cpp g++ -std=c++11 tuple2.o printtuple.hpp.gch -o tuple ld: warning: ignoring file printtuple.hpp.gch, file was built for unsupported file format ( 0x67 0x70 0x63 0x68 0x2B 0x30 0x31 0x34 0xB8 0x62 0x17 0x5B 0x21 0x3A 0xBC 0x15 ) which is not the architecture being linked (x86_64): printtuple.hpp.gch 程式碼(Code):(請善用置底文網頁, 記得排版) http://pastie.org/pastes/9933717 printtuple.hpp http://pastie.org/9933732 tuple2.cpp http://pastie.org/9933730#4 makefile 還在研究makefile.. 補充說明(Supplement): 不知道這個warning是什麼意思 想請教各位大大 感謝~ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.228.35.179 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1423542509.A.DE7.html

02/10 12:48, , 1F
跟你說他不會 compile header file
02/10 12:48, 1F

02/10 14:15, , 2F
謝謝解答~
02/10 14:15, 2F

02/10 14:55, , 3F
這個檔案是所謂的 precompiled header file
02/10 14:55, 3F

02/10 14:56, , 4F
不需要在指令裡指定, 只要有下相關參數就會自動拉進來
02/10 14:56, 4F

02/10 14:57, , 5F
它的用途是在當程式的許多部件都引入這個標頭檔時可以省去
02/10 14:57, 5F

02/10 14:57, , 6F
重新將標頭檔內容進行語法分析的步驟
02/10 14:57, 6F

02/10 14:58, , 7F
(大概像是「先前看這標頭檔時記下的筆記」這樣的東西)
02/10 14:58, 7F

02/10 15:04, , 8F
唔嗯, 看了一下網路文章似乎 g++ 有看到 .gch 會自動使用
02/10 15:04, 8F

02/10 15:20, , 9F
那請教一下 用hpp的話 makefile寫法有不一樣嗎
02/10 15:20, 9F

02/10 19:33, , 10F
不使用 precompiled header 的話, 把第 6,7 行拿掉
02/10 19:33, 10F

02/10 19:33, , 11F
第 2,3 行的 printtuple.hpp.gch 也拿掉就好
02/10 19:33, 11F

02/10 22:10, , 12F
了解了 感謝~
02/10 22:10, 12F
文章代碼(AID): #1KsOZjtd (C_and_CPP)