| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2298 人关注过本帖
标题:急需解决error LNK2001: unresolved external symbol "public: __thiscall ...
只看楼主 加入收藏
iminic
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-5-12
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
急需解决error LNK2001: unresolved external symbol "public: __thiscall Employee:
#include<iostream>
#include<string>
# define N 3
using namespace std;

class Employee
{public:
   Employee();
    Employee(int n,char s,string nam,string da,string p)
    {
    num=n;
    sex=s;
    name=nam;
    date=da;
    position=p;
    }
   
   
    void set_1();
    void display();
private:
    int num;
    char sex;
    string name;
    string date;
    string position;
};

void Employee::set_1()
{
    cin>>num>>sex>>name>>date>>position;
}
 void Employee::display()
{
    cout<<num<<sex<<name<<date<<position<<endl;
}
int main(void)
{
    class Employee emp[N];
    cout<<"please enter the information"<<endl;
    for(int i=0;i<N;i++)
    emp[i].set_1();
    for(int k=0;k<N;k++)
    emp[i].display();
    return 0;
}
error LNK2001: unresolved external symbol "public: __thiscall Employee::Employee(void)" (??0Employee@@QAE@XZ)
Debug/1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

1.exe - 2 error(s), 0 warning(s)
搜索更多相关主题的帖子: Employee symbol public external 
2010-10-17 15:20
m21wo
Rank: 10Rank: 10Rank: 10
等 级:青峰侠
威 望:4
帖 子:440
专家分:1905
注 册:2010-9-23
收藏
得分:20 
程序代码:
#include<iostream>
#include<string>
# define N 3
using namespace std;

class Employee
{
public:
    Employee() {};                      //加 {}
    Employee(int n,char s,string nam,string da,string p)
    {
    num=n;
    sex=s;
    name=nam;
    date=da;
    position=p;
    }
    void set_1();
    void display();
private:
    int num;
    char sex;
    string name;
    string date;
    string position;
};

void Employee::set_1()
{
    cin>>num>>sex>>name>>date>>position;
}
void Employee::display()
{
    cout<<num<<sex<<name<<date<<position<<endl;
}
int main(void)
{
    Employee emp[N];
    cout<<"please enter the information"<<endl;
    for(int i=0;i<N;i++)
    emp[i].set_1();
    for(int k=0;k<N;k++)
    emp[k].display();
    return 0;
}



你的默认构造没加{}

If You Want Something, Go Get It, Period.
2010-10-17 16:49
iminic
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-5-12
收藏
得分:0 
回复 2楼 m21wo
已经解决!谢了
2010-11-06 16:23
快速回复:急需解决error LNK2001: unresolved external symbol "public: __this ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014671 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved