看板 EE_DSnP 關於我們 聯絡資訊
我在hw4下了make指令 出現了很多不太能理解的問題 memMgr.h:177: 錯誤:「class T」 的宣告 77: template <class T> 178: class MemMgr 179: { 180: // S is the size of each element; make it multiple of SIZE_T 181: #define S ((sizeof(T) + SIZE_T_1) / SIZE_T * SIZE_T) memMgr.h:96: 錯誤: 隱藏了模版參數 「class T」 memTest.h:15: 錯誤:expected nested-name-specifier before 「namespace」 memTest.h:15: 錯誤:expected unqualified-id before 「namespace」 memTest.h:15: 錯誤:expected `;' before 「namespace」 memTest.h:15: 錯誤:expected unqualified-id before 「namespace」 /usr/include/sys/times.h:32: 錯誤:expected unqualified-id before string constat memCmd.cpp:139: 錯誤:expected `}' at end of input memMgr.h: In constructor 「MemRecycleList<T>::MemRecycleList(size_t)」: memMgr.h:102: 錯誤:類別 「MemRecycleList<T>」 沒具名為 「_arrSize」 的欄位 memMgr.h:102: 錯誤:類別 「MemRecycleList<T>」 沒具名為 「_first」 的欄位 memMgr.h:102: 錯誤:類別 「MemRecycleList<T>」 沒具名為 「_nextList」 的欄位 102: MemRecycleList(size_t a = 0) : _arrSize(a), _first(0), _nextList(0) {} 103: ~MemRecycleList() { reset(); } . . . 還有很多類似的 最下面還有這個 > building memTest... /usr/bin/ld: cannot find -lmem collect2: ld 回傳 1 make[1]: *** [../../bin/memTest] Error 1 make: *** [main] Error 2 有人可以給我一點方向嗎? 感謝! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.4.234
HigherKuo:話說我都不寫直接compile也過不了.. 04/29 20:45
ric2k1:邠d一下你的 memCmd.cpp 前幾行有沒有寫錯? 04/29 21:10
ric2k1:mem package 沒有 compile 過的話, 最後就會complain -lmem 04/29 21:11
HigherKuo:解決了,謝謝教授!! 04/30 21:56