Problem including file
Jun 1, 2010 at 1:20am UTC
Hello, I am new to this and using DevC++ to compile my program. I've doublechecked and for some reason when I try to compile i get the error "In file included from main.cpp" Here is the code, split into three different files.
main.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <cstdlib>
#include <iostream>
#include <string>
#include "safestuff.h"
using namespace std;
int main(int argc, char *argv[])
{
cout << "Surprise surprise" << endl;
cout << "The combination is" << endl;
cout << SafeCracker(12) << endl;
system("PAUSE" );
return EXIT_SUCCESS;
}
safestuff.h
string SafeCracker(int SafeID);
safestuff.cpp
1 2 3 4 5
#include <string>
string SafeCracker(int SafeID)
{
return "13-26-16" ;
}
Can someone tell me whats wrong? Thanks!
Jun 1, 2010 at 1:45am UTC
string is in the std namespace, so it needs to be std::string.
Jun 1, 2010 at 1:47am UTC
doh. thanks.
Topic archived. No new replies allowed.