Ряд ошибок "undefined reference to ..."
При попытки создать копию своего проекта, путём воссоздания его структуры и копированию отдельно содержимого каждого файла, созданный проект при компиляции выдаёт ряд ошибок:
Причём при компиляции идентичного проекта, с которого я копировал, ошибок не возникает. В чём может быть проблема? Прилагаю код трёх файлов:
main.cpp
#include <iostream>
#include "Soft.h"
int main()
{
Software None;
None.print();
Software b("2Lab1", ".cbp", "Sernicon");
b.print();
Software c = b;
c.settype(".txt");
c.print();
return 0;
}
Soft.cpp
#include <iostream>
#include "Soft.h"
using namespace std;
Software::Software()
{
this->name = "None";
this->type = "None";
this->author = "None";
}
Software::Software(const string name, const string type, const string author)
{
this->name = name;
this->type = type;
this->author = author;
}
Software::Software(Software &s)
{
this->name = s.name;
this->type = s.type;
this->author = s.author;
}
Software::~Software()
{
std::cout << name << type << " by " << author << " was deleted.\n" << std::endl;
}
string Software::getname() { return name; }
void Software::setname(const string name) { this->name = name; }
string Software::gettype() { return type; }
void Software::settype(const string type) { this->type = type; }
string Software::getauthor() { return author; }
void Software::setauthor(const string author) { this->author = author; }
void Software::print()
{
cout << "Name: " << name << "\nType: " << type << "\nAuthor: " << author << endl << endl;
}
Soft.h
#ifndef SOFTWARE_H_INCLUDED
#define SOFTWARE_H_INCLUDED
using namespace std;
class Software
{
private:
string name;
string type;
string author;
public:
Software();
Software(const string name, const string type, const string author);
Software(Software &s);
~Software();
string getname();
void setname(const string name);
string gettype();
void settype(const string type);
string getauthor();
void setauthor(const string author);
void print();
};
#endif // SOFTWARE_H_INCLUDED