Question about a project containing multiple main functions

Question about a project containing multiple main functions

In practice printf function and sizeof function, I created two source files printf function.c and sizeof function.c

image-20220124085419411

At this time, there are two main functions in one, and the system reports an error

f348ccd2febe5239387b72a4ad905de6f58679f1

Solution 1

Right click on the solution – add – create a new page, create a new project

b3439115e3d0a661f4e7757bd334526fdfbfe948

Then move the printf function.c or sizeof function.c to the new project

d10b3237471080c41aae57121ac43bd53e625f90

Right-click on the project – set it as a startup project, so that one of the projects can be run! Set which project you want to run as the startup project

ef036d8e166d12b2caa5dc7e07baedc78446c655

Solution 2

Right-click on one of the files and select Properties!

d740048e2d5b301c28076ef58b9ffad65a130c62

Select Yes for Exclude from build.

38255a81806c4072b8f33b9a3312904aeabadb30

Guess you like

Origin blog.csdn.net/fidshgidu/article/details/122688930