运行时
cmake --build . --config Release --clean-first
在macOS上我找到的here代码已获得
Scanning dependencies of target LinAlg
[ 20%] Building CXX object lib/CMakeFiles/LinAlg.dir/source/cmatrix.cpp.o
[ 40%] Building CXX object lib/CMakeFiles/LinAlg.dir/source/cvector.cpp.o
[ 60%] Linking CXX static library libLinAlg.a
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: warning for library: libLinAlg.a the table of contents is empty (no object file members in the library define global symbols)
[ 60%] Built target LinAlg
Scanning dependencies of target main
[ 80%] Building CXX object main/CMakeFiles/main.dir/source/main.cpp.o
[100%] Linking CXX executable main
Undefined symbols for architecture x86_64:
"LinAlg::Vector::CVector<float>::show()", referenced from:
_main in main.cpp.o
"LinAlg::Vector::CVector<float>::CVector(unsigned long)", referenced from:
_main in main.cpp.o
"LinAlg::Vector::CVector<float>::~CVector()", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture x86_64
collect2: Fehler: ld gab 1 als Ende-Status zurück
make[2]: *** [main/main] Error 1
make[1]: *** [main/CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2
我现在搜索了一个小时,但不知道出了什么问题。有人可以帮忙吗?
谢谢。
PS:我不想在这里发布所有代码,因为我不想超载。