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

0 votes
1 answer 19 views
19 views
Problem: I have a program that must calculate the basic mathematical operations (addition, subtraction, multiplication and division) through objects that inherit from a common class. The Elementary class contains the virtual method process () and the classes Addition, Subtraction, Mult and Div must inherit from it ... < endl << "2.No" << endl; cin >> x; } while (x == 1); } Someone could help me?
asked Jan 24 sasha 16.2k points
0 votes
1 answer 124 views
124 views
Problem : Error: No matching member function for call to 'push_back'
asked Feb 23 Shovo210 13.8k points
0 votes
1 answer 19 views
19 views
Problem: I get the error when I want to reserve memory for 'n' movies //Main.cpp enter the code here #include <iostream> #include "Movie.h" #include "Tab.h" #include "Cine.h" #include <string.h> #include <cstdlib> using namespace std; int main () { Cinema * C; int n, i; cout << "How ... cout << "Movie Name:" << Movie Name << endl << "Genre:" << Genre << endl << "Duration:" << Duration << endl; } c
asked Feb 7 sasha 16.2k points
0 votes
1 answer 19 views
19 views
no matching function for call to 'liquidcrystal_i2c::begin()'
asked Feb 16 ArifulIslam 7.5k points
0 votes
2 answers 11 views
11 views
Problem: I have following code: #include<iostream> #include<conio.h> using namespace std; int cube ( int number) { return number * number * number; } Now, I want to call this function in my main() function. I tried the following: int main() { cube(); cout<<"The cube is "<<value; } But this is giving certain errors. I do not know what is wrong as I am a beginner. Please help. Thanks!
asked Mar 5 Code Learner 9.2k points
0 votes
1 answer 6 views
6 views
Problem: I am stuck during learning as I have already mentioned in my question someone please cooperate me to continue my project-Thanks
asked Mar 22 sadi1982 36.3k points
0 votes
1 answer 15 views
15 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 13k points
0 votes
1 answer 19 views
19 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 16.2k points
1 vote
1 answer 186 views
186 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 608 views
608 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