gpt4 book ai didi

c++ - 在以下程序中出现编译链接错误

转载 作者:行者123 更新时间:2023-11-30 02:53:27 25 4
gpt4 key购买 nike

我收到一个错误,我完全不知道为什么..我已经搜索过这个网站,但找不到任何东西...

我的错误是:`LNK2019: 函数“public: __thiscall sale::sale(int, int,int,class agent,class campaign)"

这是我的代码:

#include "stdafx.h";
#include <iostream>
#include "campaign.h";

//constructor
campaign::campaign()
{
campaign_name = "Campaign Undefined";
campaign_id = -1;
campaign_data_type = 0;
campaign_region_type = 0;
}

/////////////////////////////
//Accessor Functions //
///////////////////////////

std::string campaign::getName()
{
return campaign_name;
}

int campaign::getCampID()
{
return campaign_id;
}

int campaign::getDataType()
{
return campaign_data_type;
}

int campaign::getRegionType()
{
return campaign_region_type;
}

/////////////////////////////
//Mutator Functions //
///////////////////////////

void campaign::setName(std::string newName)
{
campaign_name = newName;
}

void campaign::setCampID(int newCampID)
{
campaign_id = newCampID;
}

void campaign::setDataType(int newDType)
{
campaign_data_type = newDType;
}

void campaign::setRegionType(int newRType)
{
campaign_region_type = newRType;
}

很抱歉这篇超长的帖子,如果这里有人有大约 15 分钟的时间并且没有更好的事情可做,如果你能筛选我的代码并给我一个关于我做错了什么的线索,我将不胜感激。谢谢:)

最佳答案

您没有为 campaign 定义析构函数。将其放入您的实现文件中:

campaign::~campaign()
{

}

如果你想让你的类使用默认的析构函数,你可以从你的头文件中删除~campaign(void); 然后你就不需要定义它了。

关于c++ - 在以下程序中出现编译链接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18012309/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com