Witam oglądając kurs Tomasza Jaśniewskiego dotarłem go odcinka nr 54 i robiąc przynajmniej tak mi się wydaje wszystko tak jak Pan Tomasz nie mogę skompilować poprawnie pliku dołączam mój kod i proszę o pomoc błąd wyskakuje w pliku 054_1.cpp prze mojej klasie wyskakuje że nie jest nigdzie zadeklarowana i że nie ma typu oto pliki
main.cpp
#include "main.hpp"
/**
Pliki .hpp czyli nagłówkowe
CTRL+F11 - wymusza zbudowanie wszystkiego (wszystkich plików)
*/
#include "054.hpp"
int main()
{
setlocale(LC_ALL, "");
srand(time(0));
return 0;
}
main.hpp
#ifndef MAIN_INCLUDED
#define MAIN_INCLUDED
#include <iostream> // cout + cin itp.
#include <iomanip> // manipulatory do strumienia, takie jak setw(5) itp.
#include <ctime> // czas
#include <cmath> // funkcje matematyczne
#include <cstdio> // stara z C operacje we/wy
#include <cstring> // stare funkcje z C na char[]
#include <fstream> // pliki
#include <sstream> // stringstream
using namespace std;
#endif
054.hpp
#ifndef HPP054_INCLUDED
#define HPP054_INCLUDED
class Human;
class Human {
public:
string name="John";
string lastname="Doe";
unsigned year=2000;
Human();
Human(string n, string l, unsigned y);
void show();
};
// deklaruję sobie też jakąś funkcję
/** ta funkcja coś robi ... */
#include "054_1.cpp"
#endif // MYHPP_INCLUDED
054_1.cpp
#include "main.hpp"
using namespace std;
Human::Human() {}
Human::Human(string n, string l, unsigned y) {
name = n; lastname = l; year = y; // this-> jest domyślne, gdy mam doczynienia ze zmienną której nigdzie nie deklarowałem
}
void Human::show() {
cout << name << " " << lastname << " born in " << year << "\n";
cout << "*===========================*\n";
}