When trying to compile this:
Code:
#include <iostream>
using namespace std;
void DoubleIt(int *pointer);
int main ()
{
int a = 0;
int b = 0;
//int *ptr_a = &a;
//int *ptr_b = &b;
cout << "Enter a value for a: ";
cin >> a;
cout << "Enter a value for b: ";
cin >> b;
cout << "Double a is " << DoubleIt(&a) << ".\n";
cout << "Double b is " << DoubleIt(&b) << ".\n";
return 0;
}
void DoubleIt(int *pointer)
{
*pointer *= 2;
}
GCC says this:
Code:
$ g++ doubleit.cpp -o doubleit
doubleit.cpp: In function ‘int main()’:
doubleit.cpp:22: error: no match for ‘operator<<’ in ‘std::operator<< [with _Traits = std::char_traits<char>](((std::basic_ostream<char, std::char_traits<char> >&)(& std::cout)), ((const char*)"Double a is ")) << DoubleIt(ptr_a)’
(and a WHOLE lot more (looks like mostly the same message though)).
This strikes me as strange, because it seems to be complaining about I/O, but as far as I can tell there aren't any syntax errors. I've been looking at this for about an hour and can't figure out what's wrong.
Any ideas?