改了几个小时了,求解为什么老是一使用Manger函数就报链接错误
//这是文件method.cpp
#include "File.hpp"
/*错误 严重性 代码 说明 项目 文件 行 禁止显示状态LNK2005 "public: __cdecl Customer::Customer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0Customer@@QEAA@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) 已经在 method.obj 中定义 Project1 D:\c++\Whale market\Project1\Project1\whalemarket.obj 1 */
string Customer::GetName() {
return name;
}
string Customer::GetCipher() {
return cipher;
}
string Customer::GetId() {
return id;
}
void Customer::SetName(string name) {
this->name = name;
}
void Customer::SetCipher(string cipher) {
this->cipher = cipher;
}
Customer::Customer(string name, string cipher) {
this->name = name;
this->cipher = cipher;
}
Customer::Customer() {
}
void Product::show() {
cout << "************************************************************************************" << endl;
cout << "id" << " " << "name" << " " << "price" << " " << "time" << " " << "sellerId" << " " << "status" << endl;
cout << this->id << " " << this->name << " " << this->price << " " << this->time << " ";
cout << this->seller.GetId() << " " << status << endl;
cout << "************************************************************************************" << endl;
}
string Manger::GetName() {
return name;
}
string Manger::GetCipher() {
return cipher;
}
string Manger::GetId() {
return id;
}
void Manger::SetName(string name) {
this->name = name;
}
void Manger::SetCipher(string cipher) {
this->cipher = cipher;
}
Manger::Manger(string name, string cipher) {
this->name = name;
this->cipher = cipher;
}
Manger::Manger() {
}
void Manger::menu() {
//cout << "================================================================================" << endl;
//cout << "1:查看所有商品 2:搜索商品 3:查看所有订单 4:查看所有用户" << endl;
//cout << "5:删除用户 6:下架商品 7:注销" << endl;
//cout << "================================================================================" << endl;
//cout << "请选择您的操作:";
//char choice;
//cin >> choice;
//while (getchar());
///*switch((int)(choice - '0')){
//case 1:
// AllProduct();
//case 2:
// SearchProduct();
//case 3:
// CheckAllGoods();
//case 4:
// ShowAllCustomer();
//case 5:
// DeletCustomer();
//case 6:
// CancelProuct();
//case 7:
// SignOut();
//}*/
}
vector<Manger> mangers;
vector<Customer> customers;
vector<Product> pros;
void AllProduct() {
for (Product a : pros) {
a.show();
}
}
void show() {
}
//这是File.hpp
#define _CRT_SECURE_NO_WARNINGS 0
#include<string>
#include<thread>
#include<iostream>
#include<vector>
using namespace std;
class Customer {
private:
string name;
string cipher;
string id;
public:
Customer();
Customer(string name, string cipher);
string GetId();
string GetName();
string GetCipher();
void SetName(string name);
void SetCipher(string cipher);
};
class Manger{
private:
string name;
string cipher;
string id;
public:
Manger();
Manger(string name, string cipher);
string GetId();
string GetName();
string GetCipher();
void SetName(string name);
void SetCipher(string cipher);
void menu();
};
class Product {
public:
void show();
private:
string name;
string status;
string time;
string id;
Customer seller;
double price;
};
void menu();
void AllProduct();
Product SearchProduct();
void CheckAllGoods();
void ShowAllCustomer();
void DeletCustomer();
void CancelProuct();
void SignOut();