How to compile C program with multiple files in Xcode

纵饮孤独 提交于 2019-12-04 21:32:17

Sure it is.

Assuming you're starting from scratch (without an existing XCode project), do a "new project" and choose the "Mac OS Application" -> "Command Line Tool" -> "C" project template.

That will give you a skeleton project with a template "main.c". Edit/replace "main.c" as needed, and add the rest of your .c files to the "source" group and build.

Only the last .c is significant. main.c.c.c.c will be treated as a C-language source.

Not "fooling" though, check the column of checkboxes in the project list view. It's marked with a bullseye as the header. The checkmark signifies that the source is compiled into the selected target. Unchecked boxes are the only possible problem I can think of.

Definitely - just add all the .c files to your project.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!