简体   繁体   English

通过gcc45的MacPorts安装后,如何在我的Mac上使用它来构建C语言?

[英]after the installation via MacPorts of gcc45, how can I use it to build C language on my Mac?

The following html link contains all the relevant bash command line records of the installation process.以下 html 链接包含安装过程的所有相关 bash 命令行记录。 Thank you for help!谢谢你的帮助!

That was a bad question这是一个糟糕的问题

I didn't use XCode through I know Xcode will make it easier!我没有使用 XCode,因为我知道 Xcode 会让它更容易! I use an Air, memory of 4GB currently.我目前使用的是 Air,内存为 4GB。 If this won't work easily I probably will quit learning C or run and compile C on Windows.如果这不容易奏效,我可能会停止学习 C 或在 Windows 上运行和编译 C。 :( :(

And XCode stuff, whatever.和 XCode 的东西,不管。

You command-line output indicates rather clearly that you aren't telling gcc what to compile, so it's throwing its hands up in exasperation:你的命令行输出相当清楚地表明你没有告诉gcc编译什么,所以它愤怒地举起了手:

$ gcc
i686-apple-darwin10-gcc-4.2.1: no input files

You'll need to specify the file you're compiling.您需要指定正在编译的文件。 Better yet, use an IDE, like Xcode.更好的是,使用 IDE,例如 Xcode。

< Shrug > What do you want us to say? <耸肩>你想让我们说什么?

Obviousy Macports is trying to build/install gcc but it can't without a compiler. Obviousy Macports 正在尝试构建/安装 gcc,但它不能没有编译器。 Yes gcc can be built without a preexisting compiler , but good luck and why?是的 gcc 可以在没有预先存在的编译器的情况下构建,但祝你好运,为什么? Especially when XCode is a free download , click click let it start and a little while later it's done.特别是当 XCode 是免费下载的时候,点击 click 让它开始,稍后它就完成了。 At that point as pointed out elsewhere, gcc, g++ will work, but it's not actually gcc but clang in disguise.那时正如其他地方所指出的那样,gcc、g++ 将起作用,但它实际上不是 gcc,而是伪装的叮当声。

If you want, you can use macports or brew or whatever later if you really want to, but again why?如果你愿意,你可以使用 macports 或 brew 或者以后如果你真的愿意,但为什么? For programs that only work using gcc extensions?对于仅使用 gcc 扩展工作的程序? Doubt it.怀疑。 You just want ac/c++ compiler.你只想要 ac/c++ 编译器。 If you ever want to do programs for the Mac or IPhone, you need XCode anyway, gcc won't do.如果你想为 Mac 或 iPhone 编写程序,无论如何你都需要 XCode,gcc 不会。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 不仅gcc本身的安装足以在Windows机器中构建c语言吗? - Is not only gcc itself installation enough to build c language in my windows machine? 如何向GCC添加基于C的语言 - How can I add a C-based language to GCC 如何使用 GCC 在 Mac 终端上调试 C 程序? - How can I debug a C program on Mac Terminal with GCC? 我可以在Mac上安装libexpect并将其与Xcode一起在C中使用吗? - Can I install libexpect on my Mac and use it in C with Xcode? 如何从 this.txt 文件中获取此信息并在我的代码中正确使用它(C 语言) - How can I get this information from this .txt file and use it in my code properly (C language) 我可以使用 C 作为我的引擎的脚本语言吗? - Can I use C as a scripting language for my engine? 我如何在.Net(C IDE)中使用C语言 - How Can i Use C language in .Net (C IDE) 通过MacPorts安装GD2库的GCC编译C程序时出现问题 - Problem to compile a C-program by GCC with GD2 library installed via MacPorts 如何使用“静态链接”和“动态链接”与gcc和Visual Studio构建C / C ++程序? - How can I build a C/C++ program using `static linking` & `Dynamic linking` with gcc & Visual studio? 如何在Linux GCC上用C构建我的第一个PHP扩展? - How Do I Build My First PHP Extension in C on Linux GCC?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM