.cpp文件中未定义的引用错误
undefined reference error in the .cpp file
我正在尝试编写一个函数,该函数将迭代器返回到具有正确字符串标识符的"节点"(我创建的对象(:
list<node>::iterator point_component_from_out(const string out,const list<list<node>>::iterator &row){
list<node>::iterator it=row->begin(),r_it=row->begin();
vector<string> vct;
it++;
for(it;it!=row->end();it++){
vct=it->get_outputs_labels();
for(vector<string>::iterator vct_it=vct.begin();vct_it!=vct.end();vct_it++){
if(*vct_it==out){
r_it=it;
}
}
}
return r_it;
}
现在我从另一个函数调用这个函数,该函数与前一个函数位于同一个.cpp文件中。 (函数的一小部分(:
void graph::build_chain(string out,list<list<node>>::iterator row){
list<node>::iterator it_node,support_it;
list<list<node>>::iterator new_row;
string new_out;
int i=0;
vector<string> declared_outputs,linked_outputs,declared_inputs,linked_inputs;
//funzione che ritorna l'iteratore che punta alla porta con quell'out
it_node=point_component_from_out(out,row);
此时,当我构建项目时,我从构建器收到此错误:
undefined reference to `graph::point_component_from_out(std::string, std::_List_iterator<std::list<node, std::allocator<node> > > const&)'
relocation truncated to fit: R_X86_64_PC32 against undefined symbol `graph::point_component_from_out(std::string, std::_List_iterator<std::list<node, std::allocator<node> > > const&)'
如果我单击错误,它会显示它指的是我向您展示的第二个代码的最后一行。
如果您正在编写point_component_from_out
作为函数的实现 - 请确保它在graph::build_chain
函数之前,如果point_component_from_out
也是类成员并且您正在为方法编写实现 - 请检查您是否忘记了类说明符:MyClass::method
。
相关文章:
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- C++引用错误
- 已定义函数时出现 G++ "未定义的引用"错误
- 链接 cmake 时出现未定义的引用错误
- 只有级联分类器会发出未定义的引用错误
- 2个模板化类的非模板友元函数未定义引用错误
- C/C++ 取消引用错误:在空检查之前取消引用
- 为什么我的C++代码无法编译,出现未定义的引用错误
- 我的代码中C++未定义的引用错误?
- 模板专用化会导致未定义的引用错误
- .cpp文件中未定义的引用错误
- c++ 中目录中文件的未定义引用错误
- Opencv4 使用 pkg-config 给出未定义的引用错误
- 使用Cygwin C++时出现未定义的引用错误,为什么我的文件没有链接?
- 共享指针取消引用错误
- 编译简单的多文件类程序时出现未定义的引用错误
- 模板函数产生未定义的引用错误
- 调用提取重加载器会产生对"运算符"的未定义引用错误>>
- 如何修复"未定义的引用"错误 opencv 和 g++
- 未定义的引用错误,我该怎么办?