multiple definition of main first defined here

前端 未结 3 1307
予麋鹿
予麋鹿 2021-01-29 04:37

I\'m new to programming and currently I\'m learning C programming. I\'m writing codes on the code blocks and in it using GCC compiler. When I create a new project, (as you know

3条回答
  •  死守一世寂寞
    2021-01-29 05:04

    Some computer languages allow you to use the same function name for different functions ( which are identified by their parameters and sometimes return types ). That's called overloading. C does not allow this. Functions in C must have unique names.

    The main() function is a special one in C as it is used as the standard entry point for applications. That is, the main() function will be called first and your application should start and (typically) end in that function.

    As a beginner I would suggest you avoid automated editor features that create and build projects for you. You will miss out on learning how things work doing that. Use an editor to start from empty files and learn how they all connect and how to use the compiler from the command line. The command line is something every beginner should start from, IMO.

    It may be harder to learn, but it will give you a much better feel for what is going on.

提交回复
热议问题