Re: [問題] undefined reference to ..
※ 引述《kornelius (Kornelius)》之銘言:
: 我在 hashmap.h 內定義
: 然後在 hashmap.cpp 內實做
: 主程式寫在 hashtest2.cpp
: 然後編譯,卻出現這樣的 bug ,一直想不透是什麼問題...搞了好久啊啊啊 Orz
: 也檢查過,也沒有忘了實做的函數
: $ g++ hashtest2.cpp hashmap.cpp -o test
: /tmp/ccKWvjRU.o: In function `main':
: hashtest2.cpp:(.text+0x9a): undefined reference to `HashMap<int,
: int>::HashMap()'
我在做類似的事情,我的處理法是:
g++ -c hashmap.cpp
g++ -o test hashtest2.cpp
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.112.226.125
討論串 (同標題文章)
Programming 近期熱門文章
PTT數位生活區 即時熱門文章