C++ 当我在Code::Blocks中有来自同一组源文件的两个.cpp文件时,如何运行其中一个?

C++ 当我在Code::Blocks中有来自同一组源文件的两个.cpp文件时,如何运行其中一个?,c++,codeblocks,C++,Codeblocks,我有两个不同的.cpp文件(链表),它们位于同一个项目的同一组源下。我试着运行一个名为“customer”的链接列表文件,但它只运行另一个名为“video”的文件。如何运行“客户”链接列表文件 我的customer.cpp文件处于活动状态,但它仍在运行“视频”链接列表文件的程序 基本上,我试图带来两个单独的客户名单和另一个单独的名单与视频 但是,当我尝试在customer.cpp选项卡下执行程序时,我以为它应该运行该选项卡,但它运行的是video.cpp文件……我是不是遗漏了什么 #includ

我有两个不同的
.cpp
文件(链表),它们位于同一个项目的同一组源下。我试着运行一个名为“customer”的链接列表文件,但它只运行另一个名为“video”的文件。如何运行“客户”链接列表文件

我的
customer.cpp
文件处于活动状态,但它仍在运行“视频”链接列表文件的程序

基本上,我试图带来两个单独的客户名单和另一个单独的名单与视频

但是,当我尝试在customer.cpp选项卡下执行程序时,我以为它应该运行该选项卡,但它运行的是video.cpp文件……我是不是遗漏了什么

#include <iostream>
using namespace std;

struct video
{
 char title[40],star1[20],star2[20],star3[20],star4[20],prod[20],dir[20],proco[40];
 int copy;
 video *next;
 };
 video *first = NULL, *current = NULL;
  int optn = 0;
#包括
使用名称空间std;
结构视频
{
char title[40]、star1[20]、star2[20]、star3[20]、star4[20]、prod[20]、dir[20]、proco[40];
整型拷贝;
视频*下一步;
};
视频*first=NULL,*current=NULL;
int optn=0;
^这是video.cpp文件的视频列表的节点结构

   #include <iostream>
   using namespace std;

   struct customer
   {
   char f_name[20],l_name[20];
    int acc_num;
    customer *next;
     };
     customer *start = NULL, *pointer = NULL;
     int option = 0;
#包括
使用名称空间std;
结构客户
{
字符f_name[20],l_name[20];
int acc_num;
客户*next;
};
客户*start=NULL,*pointer=NULL;
int选项=0;
^这是我的客户链表节点结构。customer.cpp文件。这两个文件都位于同一项目下的两个独立源文件中

int main(void)
{
 first = NULL;
 current = NULL;
 do
    {
        display();
        cout << endl;
        cout << "Choose an option: " << endl;
        cout << "1. Move the current position forward once." << endl;
        cout << "2. Move the current position backwards once." << endl;
        cout << "3. Add a video at the beginning of the list." << endl;
        cout << "4. Add a video at the current position of the list." << endl;
        cout << "5. Add a video at the ending of the list." << endl;
        cout << "6. Delete the first video from the list." << endl;
        cout << "7. Delete the video at current position from the list." << endl;
        cout << "8. Delete the last video from the list." << endl;
        cout << "9. End program." << endl;
        cout << endl << " >> " ;
        cin >> optn;
         switch (optn)
        {
            case 1 : currentfor();
            break;
            case 2 : currentbac();
            break;
            case 3 : addbeginning();
            break;
            case 4 : addmiddle();
            break;
            case 5 : addending();
            break;
            case 6 : deletebegin();
            break;
            case 7 : deletemiddle();
            break;
            case 8 : deleteend();
            break;
        }
    }
    while (optn != 9);
   }
int main(无效)
{
第一个=空;
电流=零;
做
{
显示();

cout如果您只想运行客户实现,您应该:

“Customer.h”-头文件 “Customer.cpp”-类的实现或定义或其他。。。 “main.cpp”-主文件,其中:

#include <iostream>
#include <Customer.h>
int main()
{
  ...
  ...
}
#包括
#包括
int main()
{
...
...
}
如果您有两个不同的类派生自一个链表类,我认为您应该将customer类和video类分开,每个实现文件


如果答案不正确,请输入一些代码来指导我们使用您的类定义:)

如果您只想运行客户实现,您应该:

“Customer.h”-头文件 “Customer.cpp”-类的实现或定义或其他。。。 “main.cpp”-主文件,其中:

#include <iostream>
#include <Customer.h>
int main()
{
  ...
  ...
}
#包括
#包括
int main()
{
...
...
}
如果您有两个不同的类派生自一个链表类,我认为您应该将customer类和video类分开,每个实现文件


如果答案不正确,请输入一些代码以指导我们使用您的类定义:)

添加了codeblocks标记,因为这可能会帮助使用此软件的人回答此问题。哦,我不知道标记是否存在。它可能有助于简要说明每个文件中的内容(“客户”和“视频”的声明)以及这些列表的名称。不太清楚您在做什么。此外,.cpp文件通常被称为源文件-您的第一句话相当混乱。这是一个改进,但您从何处构建列表。“My customer.cpp文件处于活动状态”这并不意味着什么-IDE中的编译器将从主函数开始,并从那里运行您的程序-打开哪个选项卡无关紧要。请参见@fbin answer。如何从主函数开始?…我创建了不同的void函数,并在最后调用了它们…我将粘贴两个文件的代码,最后在其中调用函数tions.添加了codeblocks标签,因为这可能会帮助使用该软件的人回答这个问题。哦,我不知道标签是否存在。它可能有助于简要说明每个文件中的内容(“客户”和“视频”的声明)以及这些列表的名称。不太清楚您在做什么。此外,.cpp文件通常被称为源文件-您的第一句话相当混乱。这是一个改进,但您从何处构建列表。“My customer.cpp文件处于活动状态”这并不意味着什么-IDE中的编译器将从主函数开始,并从那里运行您的程序-打开哪个选项卡无关紧要。请参见@fbin answer。如何从主函数开始?…我创建了不同的void函数,并在最后调用了它们…我将粘贴两个文件的代码,最后在其中调用函数选项。我已经粘贴了两个类的定义很好…我可以理解一件事,你想得到两个“主”文件…你必须记住,编译器在你的项目中只需要一个“主”函数…如果你想只使用客户ll和分离的视频ll,我建议以下方法:#include#include“customer.h”#include“video.h”int main(){function1();function2;return 0}其中function1操纵客户类,function2操纵视频类,在每个函数中,您应该将代码放在上面…我已经粘贴了两个类的定义很好…我可以理解一件事,您想要得到两个“主”文件…您必须记住,编译器只需要一个在您的项目中使用“main”函数…如果您只想使用客户ll和单独的视频ll,我建议使用以下方法:#include#include“customer.h”#include“video.h”int main(){function1();function2;return 0}在function1操纵客户类和function2操纵视频类中,在每个函数中,您应该将代码放在上面。。。