i'm trying to write a function that returns an iterator to the "node" (object that i've created) which has the correct string identifier (code below):
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;
}
now i call this function from another function which is in the same .cpp file of the previous one. (little part of the function):
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);
at this point, when i build the project i get this error from the builder:
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&)'
if i click on the error it shows me that it refers to the last line of the second code that i've shown you.
>::iterator &row)` not `graph::point_component_from_out(const string out,const list
– drescherjm Dec 16 '19 at 15:04>::iterator &row)`. This looks like a simple typo in your code. If this is not the case please edit your question and correct the typo.