how can i do programmig in xcode?

I am using Xcode for programming in c++ language
But when I type the code and hit run it tells me there is a problem
How can I solve it? I am a beginner in computer and programming
My MacBook Pro
And this is the problem:

Ld /Users/lamiaa/Library/Developer/Xcode/DerivedData/c-awfbaiszjqjdyzfyhvlstvnfmpbe/Build/Products/Debug/c normal x86_64 (in target 'c' from project 'c')

    cd /Users/lamiaalkhunini/Creative\ Cloud\ Files/c

    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target x86_64-apple-macos10.15 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -L/Users/lamiaalkhunini/Library/Developer/Xcode/DerivedData/c-awfbaiszjqjdyzfyhvlstvnfmpbe/Build/Products/Debug -F/Users/lamiaalkhunini/Library/Developer/Xcode/DerivedData/c-awfbaiszjqjdyzfyhvlstvnfmpbe/Build/Products/Debug -filelist /Users/lamiaalkhunini/Library/Developer/Xcode/DerivedData/c-awfbaiszjqjdyzfyhvlstvnfmpbe/Build/Intermediates.noindex/c.build/Debug/c.build/Objects-normal/x86_64/c.LinkFileList -Xlinker -object_path_lto -Xlinker /Users/lamiaalkhunini/Library/Developer/Xcode/DerivedData/c-awfbaiszjqjdyzfyhvlstvnfmpbe/Build/Intermediates.noindex/c.build/Debug/c.build/Objects-normal/x86_64/c_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -stdlib=libc++ -Xlinker -dependency_info -Xlinker /Users/lamiaalkhunini/Library/Developer/Xcode/DerivedData/c-awfbaiszjqjdyzfyhvlstvnfmpbe/Build/Intermediates.noindex/c.build/Debug/c.build/Objects-normal/x86_64/c_dependency_info.dat -o /Users/lamiaalkhunini/Library/Developer/Xcode/DerivedData/c-awfbaiszjqjdyzfyhvlstvnfmpbe/Build/Products/Debug/c
Answered by szymczyk in 663028022
The error message says you have two main functions in your project. You can have only one.

When you create the project, Xcode includes a main.cpp file that has a main function. If you add a second main function, you are going to get an error. Remove one of the two main functions. If you added your own C++ file to the project, delete the main.cpp function Xcode included with the project.
If you create a Command Line Tool project and click the Run (Play) button, does the project build and run?

List the steps you are taking to create and run the project, including the code you typed. Also list the actual error message you get. The text you posted does not contain the error message.

I also recommend coming up with a different name for your project than c.
Thank you for your replay @szymczyk
It does't turn on
I start a new project and then choose C++ language
Then write the code and run it
it refuses to give me the output
and i try with another name but the same result.
How do I get to the actual error message?
1 duplicate symbol for architecture x86_64

duplicate symbol '_main' in:
    /Users/lamiaalkhunini/Library/Developer/Xcode/DerivedData/c-awfbaiszjqjdyzfyhvlstvnfmpbe/Build/Intermediates.noindex/c.build/Debug/c.build/Objects-normal/x86_64/l.o
    /Users/lamiaalkhunini/Library/Developer/Xcode/DerivedData/c-awfbaiszjqjdyzfyhvlstvnfmpbe/Build/Intermediates.noindex/c.build/Debug/c.build/Objects-normal/x86_64/ll.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Accepted Answer
The error message says you have two main functions in your project. You can have only one.

When you create the project, Xcode includes a main.cpp file that has a main function. If you add a second main function, you are going to get an error. Remove one of the two main functions. If you added your own C++ file to the project, delete the main.cpp function Xcode included with the project.
@szymczyk 

Great guess.

Where did you see in the error message that

you have two main functions in your project.




In a followup reply, the OP provided the following error message:

duplicate symbol '_main' in:
  /Users/lamiaalkhunini/Library/Developer/Xcode/DerivedData/c-awfbaiszjqjdyzfyhvlstvnfmpbe/Build/Intermediates.noindex/c.build/Debug/c.build/Objects-normal/x86_64/l.o
  /Users/lamiaalkhunini/Library/Developer/Xcode/DerivedData/c-awfbaiszjqjdyzfyhvlstvnfmpbe/Build/Intermediates.noindex/c.build/Debug/c.build/Objects-normal/x86_64/ll.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

The duplicate symbol _main told me there were two main functions in the project. I didn't guess it from the original question.

how can i do programmig in xcode?
 
 
Q