C++ 由于从结构标头创建向量数组而获取错误LNK2019?

C++ 由于从结构标头创建向量数组而获取错误LNK2019?,c++,vector,error-handling,lnk2001,C++,Vector,Error Handling,Lnk2001,我正试图通过输入文件创建一个数组向量,然后将该向量加载到我的主数组中。我也尝试在我的程序中使用相同的向量。然而,当我编译时,我得到了一堆错误LNK2019。我想我知道这是在哪里发生的,但我不确定为什么。有人能帮忙或解释一下吗?谢谢 #include <iostream> #include <string> #include <vector> #include "Database.h" #include "Reg

我正试图通过输入文件创建一个数组向量,然后将该向量加载到我的主数组中。我也尝试在我的程序中使用相同的向量。然而,当我编译时,我得到了一堆错误LNK2019。我想我知道这是在哪里发生的,但我不确定为什么。有人能帮忙或解释一下吗?谢谢

     #include <iostream>
     #include <string>
     #include <vector>
     #include "Database.h"
     #include "Registration.h"
     #include "Competition.h"
     #include "Events.h"
     #include "CompPop.h"
     #include "PushRegistration.h"
     using namespace std;

     void main()
     {
         vector<Competition> myVector = CompPop();
         vector<Registration> myRegistration = PushRegistration();
         Database home(myVector, myRegistration);

         home.Menu();

         system("pause");
     }
#包括
#包括
#包括
#包括“Database.h”
#包括“Registration.h”
#包括“Competition.h”
#包括“Events.h”
#包括“CompPop.h”
#包括“PushRegistration.h”
使用名称空间std;
void main()
{
向量myVector=CompPop();
向量myRegistration=PushRegistration();
数据库主页(myVector、myRegistration);
home.Menu();
系统(“暂停”);
}
似乎发生在: 1.向量<竞争>我的向量 2.向量myRegistration

这些是我收到的错误信息

错误LNK2001:未解析的外部符号“public:u thiscall Registration::~Registration(void)”(?1注册@@QAE@XZ)

错误LNK2001:未解析的外部符号“public:u thiscall数据库::~Database(void)”(??1数据库@@QAE@XZ)

我的Compop头,从文件读取并将内容存储到竞争向量中(类似于我的PushRegistration头)

#pragma一次
#包括
#包括
#包括
#包括
#包括
#包括“LogIn.h”
#包括“Registration.h”
#包括“Events.h”
#包括“Competition.h”
使用名称空间std;
向量CompPop()
{
ifstream myfile(“PSU Results.txt”);
绳线、tcomp、T引线、T引线、T通风孔、T定位;
矢量信息;
如果(myfile.is_open())
{
int i=0;//查找第一行
int n=0;//当前向量索引
int空间;
而(!myfile.eof())
{
getline(myfile,line);
如果(第[i]行=“*”)
{
空格=行。首先查找(“”)中的\u;
tleader=line.substr(0+1,空格);
tfollower=line.substr(空格+1,line.size());
}
其他的
{
如果(第[i]行=='-')
{
tcomp=line.substr(1,line.size());
比赛温度(tcomp、tleader、tfollower);
信息[n]=温度;
}
其他的
{
如果(!line.empty())
{
直线=直线;
空格=行。首先查找(“,”)中的\u;
tevents=行substr(0,空格);
tplacement=line.substr(空格+2,line.size());
信息[n]。推送事件(事件、位置);
}
if(line.empty())
{
n++;
}
}
}
}
}
其他的
{

cout错误信息非常清楚

未解析的外部符号“public:\u thiscall” 注册::~注册(无效)


Registration::~Registration(void)
Registration
类的析构函数。您定义了吗?

需要更多信息,例如
CompPop
Competition
的定义。还有
PushRegistration()
。尝试发布重新创建问题的最小可编译代码量。好的,添加了更多信息。谢谢!我已经…但只是作为~Registration();我在上面添加了我的注册标题。我在结尾添加了{},删除了;这似乎起到了作用。非常感谢!
      #pragma once

     #include <fstream>
     #include <sstream>
     #include <iostream>
     #include <string>
     #include <vector>
     #include "LogIn.h"
     #include "Registration.h"
     #include "Events.h"
     #include "Competition.h"
     using namespace std;

     vector<Competition> CompPop()
     {
         ifstream myfile("PSU Results.txt");

         string line, tcomp, tleader, tfollower, tevents, tplacement;
         vector<Competition> info;
         if(myfile.is_open())
         {
             int i = 0; // finds first line
             int n = 0; // current vector index
             int space;
             while(!myfile.eof())
             {
                 getline(myfile,line);

                 if(line[i] == '*')
                 {
                     space = line.find_first_of(" ");

                     tleader = line.substr(0+1, space);
                     tfollower = line.substr(space + 1, line.size());

                 }
                 else
                 {
                     if(line[i] == '-')
                     {
                         tcomp = line.substr(1, line.size());
                         Competition temp(tcomp, tleader, tfollower);
                         info[n] = temp;
                     }
                     else
                     {
                         if(!line.empty())
                         {
                             line = line;

                             space = line.find_first_of(",");
                             tevents = line.substr(0, space);
                             tplacement = line.substr(space + 2, line.size());
                             info[n].pushEvents(tevents,tplacement);
                         }
                         if(line.empty())
                         {
                             n++;
                         }
                     }
                 }
             }
         }
         else
         {
             cout << "Unable to open file";
        }

         myfile.close();

         return info;
     }
     #pragma once

     #include <fstream>
     #include <sstream>
     #include <iostream>
     #include <string>
     #include <vector>
     #include "LogIn.h"
     #include "Registration.h"
     #include "Events.h"
     using namespace std;

     struct Competition
     {
     public:

        Competition(string compName, string lead, string follow)
         {
            Name = compName;
            Leader = lead;
             Follower = follow;
         }

         void pushEvents(string name, string place)
         {
             Events one(name, place);
             Eventrandom.push_back(one);
         }

         string GetName()
         {
            return Name;

         }

         string GetLeader()
         {
            return Leader;
         }

         string GetFollow()
         {
            return Follower;
         }

         string GetEvent()
         {
            return Event;
         }

         string GetScore()
         {
            return Score;
         }

         void Print()
         {
             cout << "Leader: " << Leader << endl;
             cout << "Follower: " << Follower << endl;
            cout << "Competition: " << Name << endl;
             cout << "Events and Placement: " << endl;

             for(vector<Events>::iterator pos = Eventrandom.begin(); pos !=                      Eventrandom.end(); ++pos)
             {
                 cout << pos->eventName << " " << pos->Placement << endl;
             }

             cout << endl;
         }

         ~Competition();

     private:
        string Name, Leader, Follower, Event, Score;

         vector<Events> Eventrandom;
     };
     #pragma once

     #include <iostream>
     #include <string>
     #include <fstream>
     using namespace std;

     #define MAX_LENGTH 7 
     #define MAX_DANCES 9

     class Registration
     {
     public:

         Registration();

         Registration(string confirmationCode, string follower, string leader, string comp, string level, string dance);

         void FirstTime();

         void infoFollower();

         void infoLeader();

         string gen_random(const int len);

         string Levels();

         string Dances();

         void Print();

              void print2Confirmation();

         ~Registration();

     private:

         string CCode, Follower, Leader, Name;
         string Level, Dance;

     };