有關模板類不能使用g 編譯的問題

2021-10-17 10:32:50 字數 587 閱讀 8425

問題描述

今天在學習資料結構的時候,寫乙個矩陣類,使用到了模板,但是在編譯的時候出現了如下錯誤。

/tmp/ccyx8j1m.o: in function `main':

test.cpp:(.text+0x31): undefined reference to `matrix::matrix(int, int)'

collect2: error: ld returned 1 exit status

makefile:3: recipe for target 'tt' failed

make: *** [tt] error 1

其中makefile檔案內如下:

tt: test.cpp matrix.o

g++ test.cpp matrix.o -o tt

matrix.o: matrix.cpp

g++ -c matrix.cpp

clean:

rm *.o tt

無論怎麼實驗,總會有上述錯誤

解決辦法

關於apt get不能使用的問題

我在使用apt get update 的時候出現了這樣問題 命中 26 bionic inrelease 忽略 27 bionic inrelease 錯誤 28 bionic release 404 not found ip 91.189.95.83 80 錯誤 29 bionic release...

解決問題 ABSA Keras不能使用的問題

原本作者介紹的包的數量太少,conda安裝上後,還是在報錯,各種包沒有裝。importerror cannot import name context 解決的思路是 1.安裝的時候,如果選擇conda最好選擇conda,如果pip安裝,其他最好用pip,盡量不要混用。pip的效果更強一些 2.包要從...

解決rz命令不能使用的問題

第一種方法 root 賬號登陸後,依次執行以下命令 1cd tmp 2wget 3tar zxvf lrzsz 0.12.20.tar.gz cd lrzsz 0.12.20 4.configure make make install 上面安裝過程預設把 lsz和 lrz安裝到了 usr local...