简体   繁体   English

C ++“没有匹配的函数要调用

[英]c++ "no matching function to call

When trying to pass in an array as a param I get: 当尝试传递数组作为参数时,我得到:

"No matching function to call to ' table::retrieve(const char[16], item&, int)'

I am trying to call the function with 我试图用

program.reference.retrieve("Abecean Longfin", program.client_item, 1);

the function is 功能是

int table::retrieve(char item_in[],item*item_list, int name_flag)

I'm sure this is something simple I don't understand, but I'm new to it. 我确信这是我不了解的简单事物,但是我是新手。

The real reason your call is failing is because you're passing an item& where your function takes an item* . 调用失败的真正原因是因为您要传递item&函数接受了item* Your code also violates const correctness on the string, but in C++03 they have a special rule which makes that legal. 您的代码违反了字符串的const正确性,但是在C ++ 03中,它们具有使该规则合法的特殊规则。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM