• Register
1 vote
18 views

Problem:

Hello fellas

I’ve started learning C++ recently. I am having a problem. I can’t compile my code because some unknown error. It throws me me back “no matching function for call to c++” while I am trying to compile it. Do you have any idea?

12 7 7
15,250 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution:

Hello Pal,

As you didn’t attach any sample codes here. I am assuming you are having a type mismatch problem in your code. This the reason that GCC produces such error. The function you may be calling in your code exists, but the overload for the combination of arguments you've used doesn't exist. Example in practical terms:

struct Foo {
  int simplefun(int a) {
    // body
  }
  int simplefun(const string& a) {}
}

Then you call

Foo f;
int r = f.simplefun(0.1, "text");

In this case floating-point number doesn't match and char[] doesn't match. But if the first argument is an integer, then the compiler could apply the implicit conversion to a temporary string.

Correcting your call to a function could save you from this error.

Thanks.

13 9 6
94,240 points

Related questions

1 vote
1 answer 24 views
24 views
Problem: Can anyone guide me with the right solution as I am new and learning programming? Write the code to call the function named send_signal. there are no parameters for this function?
asked Feb 18, 2020 maddi86 5.4k points
0 votes
1 answer 2 views
2 views
Problem: This program has the user input name/age pairs and then outputs them, using a class. Here is the code.However, in int main() when I'm trying to call the functions I get "cannot call 'whatever name is' function without object." I'm guessing this is because it's looking for something like variable.test or variable.read_names. How should I go about fixing this?
asked Dec 13, 2020 Mashhoodch 5.6k points
0 votes
1 answer 12 views
12 views
I have this code: int max1 (int a, int b) {int m = a;  if (b> m) {m = b;  } return m;  } int main () {cout<< max1 (5,6) <<endl;  cout<< main () <<endl;  return 0;  } I have wanted to test that code but am afraid my computer will be damaged. What happens if the main () function is called?
asked Oct 1, 2020 sasha 5.3k points
1 vote
1 answer 70 views
70 views
Problem: Hello Experts, Well, I am looking for a simple solution. My problem might be silly to you guys but this thing driving me crazy so far. I&rsquo;ve bought an online course to learn C++ programming out of curiosity. Till this day I was doing good. I&rsquo; ... program that calls a function from another file. I mean, what is this? Could you please help out? I must recognize your help. Thanks.
asked May 3, 2020 Gavin 15.3k points
1 vote
1 answer 316 views
316 views
Problem: Hello, kodlogers, I am writing codes in C/C++ nowadays. My code is about to add two numbers. I want to add those numbers by calling a function inside my may main function. But the program is not running for some reason. It&rsquo;s saying Error: too many arguments in function call What ... int y) { int z; z = x + y; printf ("%d\n", z); } Thanks guys for your kind help and pulling me out.
asked Apr 11, 2020 Gavin 15.3k points
1 vote
1 answer 41 views
41 views
Problem: First of all, I apologize to all of you guys. It might be a noob question but I couldn't figure out the problem. I was trying to print some data from a class file in my main function. The program never returned my expected result but an error cannot call member ... endl; } }; int main(){ Student::printValue(); return 0; } Which point I am doing wrong? Could you please sort it out?
asked Apr 8, 2020 Gavin 15.3k points
0 votes
1 answer 8 views
8 views
I want to know how to call to an overloaded function be ambiguous.
asked Oct 4, 2020 Daniel Anderson 4k points
0 votes
1 answer 10 views
10 views
What i am attempting to make a easy connection with XAMPP and MySQL server, however whenever I attempt to enter data or connect to the database, i obtain this error. Why this is happen and how to solve it?
asked Sep 14, 2020 Daniel Anderson 4k points
0 votes
1 answer 90 views
90 views
can someone help me why i am seeing &ldquo;PHP Fatal error: Uncaught Error: Call to undefined function mysql_query() in /Applications/MAMP/htdocs/lprapp/config.php:23 Stack trace:#0 {main} thrown in /Applications/MAMP/htdocs/lprapp/config.php on line 23&rdquo&rdquo; this error and how to resolve it.
asked Sep 14, 2020 Daniel Anderson 4k points
0 votes
1 answer 38 views