• Register
1 vote
15 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

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

0 votes
1 answer 10 views
10 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 sasha 1.2k points
1 vote
1 answer 46 views
46 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 Gavin 15.3k points
1 vote
1 answer 55 views
55 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 Gavin 15.3k points
1 vote
1 answer 29 views
29 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 Gavin 15.3k points
1 vote
1 answer 17 views
17 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 maddi86 5.4k points