Linux 如何编写和编译 Objective-C 代码?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11437361/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I write and compile Objective-C code?
提问by Rusfearuth
How do I write and compile Objective-C code in Linux?
如何在 Linux 中编写和编译 Objective-C 代码?
I heard about Clang, but I couldn't find any example/tutorial about Clang/LLVM/Objective-C.
我听说过 Clang,但我找不到任何关于 Clang/LLVM/Objective-C 的示例/教程。
采纳答案by Aura
sudo apt-get install build-essential gobjc gobjc++ gnustep gnustep-devel libgnustep-base-dev -y
vi *.m
gcc `gnustep-config --objc-flags` *.m -lgnustep-base -lobjc
回答by Hyman
You download and build LLVM as the compiler infrastructure; then you download and build the CLANG front-end to compile C/C++ and Objective C/C++.
您下载并构建 LLVM 作为编译器基础结构;然后下载并构建 CLANG 前端以编译 C/C++ 和 Objective C/C++。
I guess you could try following this quick startguide. Mind that Clang could actually replace GCC when working with these languages.
我想您可以尝试遵循此快速入门指南。请注意,在使用这些语言时,Clang 实际上可以取代 GCC。
回答by Oscar Salguero
Take a look at http://www.gnustep.org/they have tools for developing with Objective-C 2.0 for LINUX. The source files and hints on how to install it on several LINUX distros are here: http://www.gnustep.org/resources/sources.html
看看http://www.gnustep.org/他们有使用 Objective-C 2.0 for LINUX 进行开发的工具。有关如何在几个 LINUX 发行版上安装它的源文件和提示在这里:http: //www.gnustep.org/resources/sources.html
回答by Georg
Just run the following script shown on this page:
只需运行此页面上显示的以下脚本:
https://gist.github.com/nicerobot/5652802
https://gist.github.com/nicerobot/5652802
Pay attention: During the first compiling process you will get an error. Solution is just to recompile it... It works !!! Here is the blog entry from the step by step installation but I really recommend the script!
注意:在第一次编译过程中你会得到一个错误。解决方案只是重新编译它......它有效!!!这是分步安装的博客条目,但我真的推荐脚本!
regards
问候