multiple definition of main first defined here

前端 未结 3 1249
予麋鹿
予麋鹿 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:14

    As noted in comments you can only have one main function.

    So when you start a new project you need to replace the main.c file with the main.c file you want to use. Or you can edit the 'hello world' main.c program.

    When you start a new project in code::blocks you can get a new directory with a simple program that prints 'Hello World'. This file is usually main.c. You need to edit this file or replace it. The reason that code::blocks puts this simple main.c program in the new project is so that you can compile it and test your system without having to write a new program.

提交回复
热议问题