type does not provide a call operator

43,145

It's a bit hard to tell without your posting more complete code, but consider the following:

int order(int j, int k)
{   
    return 3;
}   
int main(int argc, char *argv[])
{   
    char order;
    // order(2, 3);                                                
}

This code builds fine. However, uncommenting

    // order(2, 3);                     

causes it to fail, as within main, order is a character, not a function. From the error message, it looks like you might have some similar problem.

Share:
43,145

Related videos on Youtube

Julien Chien
Author by

Julien Chien

Updated on July 30, 2020

Comments

  • Julien Chien
    Julien Chien about 2 years

    I have this function, order, which returns vector<Node*>

    vector<Node*> order(vector<string> nodes, vector<pair<string, string>> dependencies) {
                 Graph graph = buildGraph(nodes, dependencies);
                 vector<Node*> order = buildOrder(graph.getNodes());
                 return order;
    }
    

    and I call it like this:

    vector<Node*> order2 = order(nodes, deps);
    

    However, the compiler gives this error:

    error: type 'std::__1::vector<Node *, std::__1::allocator<Node *> >' does not provide a call operator
            vector<Node*> order2 = order(nodes, deps);
                                   ^~~~~
    1 error generated.
    

    What is going wrong? 'std::__1::vector<Node *, std::__1::allocator<Node *> >' seems to suggest that there is a vector<Node*, <Node*>> or something going on, but I can't seem to figure this out.

Related