[問題] static用法
開發平台(Platform): (Ex: Win10, Linux, ...)
Linux, OS X
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
g++-8 (Homebrew GCC 8.2.0) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
g++ (GCC) 8.1.1 20180531
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
無
問題(Question):
剛剛發現這份程式碼用我手邊的編譯器都編不過,但是丟到一些較舊的編譯器卻編的過
而自己要讓他編的過則要把static拿掉(改成 const int INF = 1000000000)才會過
之前一直以為static只是會讓class共用一個實體,不會每一個都重新生成而已,但好像
又不太對,不知道static該如何準確理解呢?
餵入的資料(Input):
無
預期的正確結果(Expected Output):
編譯成功
錯誤結果(Wrong Output):
Undefined symbols for architecture x86_64:
"KuhnMunkres::INF", referenced from:
KuhnMunkres::solve() in ccXZSn3o.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
程式碼(Code):(請善用置底文網頁, 記得排版,禁止使用圖檔)
https://gist.github.com/oToToT/e16c9e8a68661fa980a0c827c907d8e8
補充說明(Supplement):
上面列的三個編譯器都不能順利編譯,但我用了Codeforces的跟Ideone提供的編譯器都可
以順利編譯
--
╭─────────────────╮
│ 遠くへと広がる海の色暖かく│
│ 夢の中で描いた絵のようなんだ│
│切なくて時をまきもどしてみるかい?│
│ No No No いまが最高!│
╰─────────────────╯ -僕たちはひとつの光
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.193.102.192
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1542816730.A.72D.html
→
11/22 00:33,
5年前
, 1F
11/22 00:33, 1F
那為什麼把INF改-INF也是好的呢?
→
11/22 08:36,
5年前
, 2F
11/22 08:36, 2F
把fill那邊的參數改成-INF
※ 編輯: oToToT (210.71.78.252), 11/22/2018 11:49:20