菜鸟教程小白 发表于 2022-12-11 20:23:53

ios - 是否可以通过命令行 gcc 编译 iPhone 应用程序?


                                            <p><p>如果我想通过命令行 gcc 编译最小的 OSX 应用程序,我可以编译文件 <code>test.m</code>:</p>

<pre><code>#import &lt;AppKit/AppKit.h&gt;
int main( int argc, char** argv ) { return 0; }
</code></pre>

<p>通过以下命令:</p>

<pre><code>gcc -c test.m
</code></pre>

<p>但是如何以同样的方式编译 iOS 应用程序呢?我将 <code>test.m</code> 更改为引用 iOScocoa touch :</p>

<pre><code>#import &lt;UIKit/UIKit.h&gt;
int main( int argc, char** argv ) { return 0; }
</code></pre>

<p>这不再编译错误:</p>

<pre><code>test.m:1:24: error: UIKit/UIKit.h: No such file or directory
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>如果您从命令行构建应用程序,您可能希望使用 xcodebuild,因为它们不仅仅包含 Objective-C 文件。</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 是否可以通过命令行 gcc 编译 iPhone 应用程序?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/7878214/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/7878214/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 是否可以通过命令行 gcc 编译 iPhone 应用程序?