[英]XCODE error: new file not built
So first I made a new project by going to File> OS X > Command Line Tool and chose C as the language.所以首先我通过转到文件> OS X> 命令行工具创建了一个新项目,并选择了 C 作为语言。 This is what I got:
这是我得到的:
Then I made a new C file called program.c:然后我创建了一个名为 program.c 的新 C 文件:
Then I pressed run.然后我按下了运行。 It didn't build successfully:
它没有成功构建:
However, when I deleted the first default file (main.c) and then pressed run program1.c....it built successfully.但是,当我删除第一个默认文件 (main.c) 然后按下 run program1.c.... 它构建成功。
My problem: Why can't I have several files under the same project and run them successfully?我的问题:为什么我不能在同一个项目下有多个文件并成功运行它们?
You can't have 2 main functions你不能有两个主要功能
Edit: each c program has to contain only one main function.编辑:每个 c 程序必须只包含一个主要功能。 Other files of that program can not implement another main function.
该程序的其他文件不能实现另一个主要功能。
Because you will have the main function declared in both files.因为您将在两个文件中声明 main 函数。 I do not know how to tell XCode to build two separate applications..
我不知道如何告诉 XCode 构建两个单独的应用程序..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.