Help with calling a string function

Hi,

I'm just beginning to learn how to code in C++ after having taken college classes on Visual C# and Java. I have a bit of a predicament that I would like help with if at all possible.

I am using a book called "C++ for Dummies, Second edition" that was written and published in 2008. I am trying to call a string function in my main function from a seperate file using a header (include "somestuff.h" for instance). My compiler recognizes the header and the function but for some reason I can not output the result to console. Here's my code and the error.

#include <iostream>
#include "somestuff.h";

using namespace std;

int main()
{
cout << "Surprise, surprise!" << endl;
cout << "The combination is (once again)" << endl;
cout << SafeCracker(12) << endl;

return 0;
}

Error: no operator "<<" matches these operands

I've been getting the same error across two compilers, one of which is Visual Studio 2010 and the other being the latest version of Code Blocks. I know the solution is probably relatively simple, so any help would be much appreciated.

Thanks!
closed account (NUj6URfi)
Please post somestuff.h
Your code should be

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

 #include <iostream> 
 #include "somestuff.h"; 

 using namespace std; 

//put I into safecracker and return I to get this to work
 int main() {
SafeCracker(12);
 cout << "Surprise, surprise!" << endl; 
 cout << "The combination is (once again)" << endl; 
 cout << I;

cin.get();
 return 0; 
 }
Last edited on
Works fine now actually. Just had to include the string header.

Thanks for the help though!
Sorry dear :( ... i have no any Idea....
Topic archived. No new replies allowed.