Hey guys I'm learning C++, from a C++ book and its come to the chapter "Sharing with Header Files....
I have two files...
p111.cpp which looks like the following
and a header file safestuff.h
And I'm getting the following errors compiling...
--------------------Configuration: p111 - Win32 Debug--------------------
Compiling...
p111.cpp
c:\p111\safestuff.h(3) : error C2146: syntax error : missing ';' before identifier 'SafeCracker'
c:\p111\safestuff.h(3) : error C2501: 'string' : missing storage-class or type specifiers
c:\p111\safestuff.h(3) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
p111.obj - 3 error(s), 0 warning(s)
Can anyone help me out?
I have two files...
p111.cpp which looks like the following
Code:
#include "stdafx.h"
#include <iostream>
#include <stdlib.h>
#include <string>
#include "safestuff.h"
int main(int argc, char* argv[])
{
string SafeCracker(int SafeID);
cout << "Surprise, surprise!" << endl;
cout << "The Combination is (once again) " << endl;
cout << SafeCracker(12) << endl;
return 0;
}
and a header file safestuff.h
Code:
#include <string>
string SafeCracker(int SafeID) {
return "13-26-16";
}
And I'm getting the following errors compiling...
--------------------Configuration: p111 - Win32 Debug--------------------
Compiling...
p111.cpp
c:\p111\safestuff.h(3) : error C2146: syntax error : missing ';' before identifier 'SafeCracker'
c:\p111\safestuff.h(3) : error C2501: 'string' : missing storage-class or type specifiers
c:\p111\safestuff.h(3) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
p111.obj - 3 error(s), 0 warning(s)
Can anyone help me out?