首次引用的未定义符号
Undefined symbol first referenced
我是c++的新手,我正在学习模板类和动态内存分配,所以如果这里有愚蠢的错误,我道歉。我不能确切地告诉什么问题是在这段代码,但我似乎不能让编译器给我任何其他的…
Undefined first referenced symbol in file indexList<timecard>::operator=(indexList<timecard> const&)/var/tmp//ccgqjCOv.o ld: fatal: Symbol referencing errors. No output written to a.out collect2: ld returned 1 exit status
template <class T>
indexList<T>& indexList<T>::operator=(const indexList<T> &other) const{
if(this != &other){
name = other.name;
ssn = other.ssn;
hours = other.hours;
payRate = other.payRate;
numOfDependents = other.numOfDependents;
unionMem = other.unionMem;
delete list;
list = new T[maxSize];
*list = *(other.list);
}//end if
return *this;
}
在{
之前的最后一个const
限定符不属于那里。
我不知道为什么你得到这个特定的错误,因为函数实际上是定义的,但是所有的赋值name =
等都是非法的,因为this
是const
。但是,复制赋值操作符是一个特殊的函数,编译器确实不希望看到这个签名。
相关文章:
- vscode g++链路故障:体系结构x86_64的未定义符号
- 体系结构x86_64的未定义符号:std:terminate(),typeinfo,运算符delete[],运算符new
- C++ 中 dlsym 的未定义符号
- 仅在 MacOS 上析构函数的未定义符号
- OSX clang++:用于 cpp 文件中显式实例化模板的体系结构x86_64的未定义符号
- PCL 出错:体系结构x86_64 @pcl的未定义符号
- clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用) - 体系结构的未定义符号 x86_64:
- 体系结构x86_64的未定义符号:链接器错误
- C++ std::vector<int> 体系结构的未定义符号 x86_64:
- 生成文件:体系结构x86_64的未定义符号
- libc++abi未定义符号:_ZTVN10__cxxabif120__si-class_type_infoE
- Xcode"体系结构x86_64的未定义符号"
- 体系结构x86_64的未定义符号:找不到原因
- SWIG链接器:未定义符号:_ZN2cv8fastFreeEPv(cv::fastFree(void*))
- 如何修复架构x86_64的未定义符号,Boost Asio 1.58
- 在Qt5上去静态库:架构的未定义符号x86_64:
- 体系结构x86_64的未定义符号:c++/ h 文件和 cpp 文件
- 监视 SDK 下的未定义符号"__Unwind_SjLj_Unregister"
- 使用 Boost/Python 的未定义符号 - 复杂
- 建筑x86_64的未定义符号:"vtkDebugLeaksManager::vtkDebugLeaksManager()",引用自: