Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Need help with a string function call

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
#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!




Comments

  • ajitreenajitreen Member Posts: 14
    I am also using code blocks but on Ubunt Linux 13.04
    As you see I have taken the liberty of commenting out
    two lines of code line numbers 2 and 10 I was able
    to reason the problem lies in called SafeCracker
    itself.

    I have gcc4.7 and I simply compiled the program by command line
    by typing

    g++ filename.cpp

    I woudl be interested in looking into the function called SafeCracker()
    also


    #include
    //#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;
    }
Sign In or Register to comment.