mardi 24 mars 2015

Cannot Run Any C++ Program with Classes in Multiple Files in Code Blocks

I cannot run any C++ program which requires to place classes in separate files in Code Blocks. An error appears, stating "no such file or directory" in 2main.


Here are my codes:


Codes of main.cpp:



#include <iostream>
#include "Sally.h"
using namespace std;

int main()
{
Sally sallyObject;
sallyObject.printCrap();

}


Codes of sally.h:



#ifndef SALLY_H
#define SALLY_H


class Sally
{
public:
Sally();
void printCrap();
protected:
private:
};

#endif // SALLY_H


Codes of sally.cpp:



#include "Sally.h"
#include <iostream>
using namespace std;

Sally::Sally()
{

}

void Sally::printCrap()
{
cout<<"Did someone say steak"<<endl;

}


Please, help me. I am new to C++. I am totally stuck! :(


Aucun commentaire:

Enregistrer un commentaire