1 duplicate symbol for architecture x86_64 Xcode

Hello, I downloaded xcode 12 to learn the C language at school but each time I run my code the message "Build failed" is displayed then there is an error "1 duplicate symbol for architecture x86_64" Can you help me please
For anyone to help you, you need to provide more information. List the steps you take to create the Xcode project. What kind of Xcode project did you make? If you create a command-line tool project and run it, do you get the Duplicate Symbol error message?

List anything else you do before building the project, such as any files you added to the project. A common cause of a Duplicate Symbol error message in a C project is to create a command-line tool project, add a new file, and add a main function to the new file. The project comes with its own main function so you end up with two main functions. A C program can have only one main function.
When creating the xcode project I chose the command line tool and choose c file after creating it there is a first file that displays hello word but each time I create a new c file there is another one with the extension.h which I do not understand but in codand in the c file when I run it the error is displayed
The .h file is a header file. Most C files have an accompanying header file.

If you create a command-line tool project and run it without adding any files, do you get the Duplicate Symbol error message?

Show the code in the new C files you're creating. When I create a command-line C project, add a C file with a header, and run the project, the project builds and prints Hello, world to the console.
When i create the command-line tool project and run it without adding file i don't get the duplicate message
the code :

#include <stdio.h>
int main ()

{
  int (a);
  int (b);
  int (i);
  printf("Give a number");
  scanf("%d",&a);
  for (i=1;i<=10;i++)
  {
    b=a*i;
    printf("%d*%d=%d\n",a,i,b);
  }
}
Are you adding a new file to the project and adding that code? If so, you have two main functions, giving you a Duplicate Symbol error. A C program can't have two main functions. Remove the main function in the main.c file that was created when you created the project.

When you create a command-line tool project, Xcode provides a main.c file. Why are you creating another file instead of using the main function Xcode created for you.

Ah ok now I understand because that's what I used to do
by removing the main function it worked thanks for your help🙏🏽

Means that you have loaded same functions twice.

I kept having this issue. make sure to delete the main.cpp file that is pre-populated. works then!

hello please I need help, when I create a c program in new project the first program "main" works , but when I add a new c file without name main then the program doesn't work ,neither the main file nor the second one.

1 duplicate symbol for architecture x86_64 Xcode
 
 
Q