• Register
1 vote
1.6k views

Problem :

I am very new to the C++programming, and so I keep facing the below error saying:

Reference to overloaded function could not be resolved; did you mean to call it?

 

Below is my code that is causing me all sorts of troubles :

#include <stdio.h>
#include <string>
using namespace std;


int main() {
    string myname;
    string myage;
    cout << "Enter the name and age: ";
    cin >> myname >> myage;
    cout << "Hello, " << myname << ", are you " << myage << " years old?\n";
    return 0;
}

I am currently using Xcode on my  Mac OS X Mojave.

I have also noticed that if I have only the current code, then it works very fine, but when I try to have multiple files, all of the files fail to work.

Can anyone explain me why my code is failing and can be the solution for it?

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

In your code the stdio.h does not define the std::cin and std::cout. That header only defines your C functions for the input and the output, like your printf and scanf. So it is the I/O header, but it is not the one you are looking for.

You need to simply include the <iostream> to have the std::cin and std::cout.

If you do above simple change your code will start giving you the desired output.

9 7 4
38,600 points

Related questions

0 votes
1 answer 20 views
20 views
Problem: Can anyone explain me why this happened and can be the solution for it: Reference to overloaded function could not be resolved; did you mean to call it?
asked Mar 14 Wafa Abu Yousef 6.1k points
0 votes
1 answer 76 views
76 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 8 views
8 views
Problem: I am trying to upload an Apple TV App to the App Store for testing purposes, but I got the issue: This Action could not be completed. Try Again (-22421)
asked Mar 19 ummesalma 29.2k points
0 votes
1 answer 2 views
2 views
Problem: I'm trying to create a program that outputs the alternating sum of a vector of integers. For example, if the input is 1 2 3 4, then the result would be 1-2+3-4 = -2. The program will also continue to run if the user enters "y" and stops when the user enters "n".
asked 2 days ago salim1 60.6k points
1 vote
1 answer 83 views
83 views
Problem : HELP! I need help understanding this error: Implicit declaration of function is invalid in C99
asked Mar 12 Sabbir Hossain 14.6k points
0 votes
1 answer 6 views
6 views
Problem: I am having some problem. Please help me with some advice.
asked Apr 2 salim1 60.6k points
0 votes
1 answer 7 views
7 views
Problem: The Eclipse C++ symbol 'std' could not be resolved.Is there a way to resolve this?
asked Apr 19 sumaiya simi 43.9k points
0 votes
1 answer 7 views
7 views
Problem: Why is the Eclipse C++ symbol 'std' could not be resolved ?
asked Apr 19 sumaiya simi 43.9k points
0 votes
1 answer 3 views
3 views
Problem: Eclipse C++: Symbol 'std' could not be resolved.How could I resolve this?
asked Apr 19 sumaiya simi 43.9k points
0 votes
1 answer 1 view
1 view
Problem: I'm having a problem installing the Command Line Developer Tools with xcode-select --install using Xcode 11 beta and on Mac Mojave 10.14.5. The download starts happening and then gets promptly stopped with a message stating: Can't install the software because it is not currently available from the software update server.
asked 1 day ago ochena 22.1k points