• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

在 Windows 上编译 Objective-C 程序

用户头像
it1352
帮助1

问题说明

一个朋友给我发了 4 个文件(两个 .m 文件,一个 .pch 文件,一个 .h 文件),他说一起编译成一个 Objective-C 程序.据我了解,它是一种 Apple 语言,我使用的是 Windows.我一直试图在 Dev-C 上的一个新项目中编译它,但没有任何运气.经过一番研究,我为它下载了一个特殊的 Objective-C 库,并在链接一个 Objective C 程序"下选择了是",但是当我尝试编译它时出现构建错误.

A friend sent me 4 files (two .m files, one .pch file, and one .h file) that he says compile together into an Objective-C program. From what I understand, it's an Apple language, and I use Windows. I've been trying to compile it in a new project on Dev-C , but haven't had any luck. After some research, I downloaded a special Objective-C library for it and selected "Yes" under "Link an Objective C program," but am getting a build error when I try to compile it.

代码使用 Cocoa,但据我朋友说,如果我导入 Foundation.h 而不是 Cocoa.h,它在 Windows 中的工作方式相同.我在 here 中找到了关于如何编译 Objective-C 程序的教程,但是我不明白第 2 步(即为 GCC 编译器设置环境变量 (C:\GNUstep\mingw\bin\gcc.exe)"),因为我的计算机上不存在该文件.当我按照编译说明进行操作时,出现此错误:sh: gcc: command not found.如果可能,我宁愿在基于 GUI 的编译器中编译它,因为我讨厌使用命令提示符.

The code uses Cocoa, but according to my friend, it will work the same in Windows if I import Foundation.h instead of Cocoa.h. I found a tutorial on how to compile Objective-C programs in Windows here, but I don't understand step 2 (which is "Set environment variable for GCC compiler (C:\GNUstep\mingw\bin\gcc.exe)") since that file doesn't exist on my computer. When I follow the compilation instructions, I get this error: sh: gcc: command not found. If possible, I'd rather compile it in a GUI-based compiler, as I hate working with command prompts.

非常感谢在任何程序上编译这些文件的任何帮助!

Any help with compiling these files on any program is greatly appreciated!

正确答案

#1

环境变量是 Windows 中所有进程存在的命名字符串.如果您打开一个 cmd 窗口并输入命令 SET,您将看到所有当前定义的环境变量的列表.

Environment variables are named strings that exist for all processes in Windows. If you open a cmd window and enter the command SET you will see a list of all the currently defined environment variables.

在 Windows XP 上,通过右键单击我的电脑并选择属性来添加一个新的.然后点击高级选项卡并点击底部的环境变量按钮.您可以为自己或系统上的所有用户添加变量.

On Windows XP, add a new one by right clicking My Computer and selecting properties. Then hit the advanced tab and click on the environment variables button at the bottom. You can either add the variable for just you or for all users on the system.

我不知道如何为更高版本的 Windows 设置环境变量,但我希望 Google 可能有一些 有用 链接.

I don't know how to set environment variables for later versions of Windows but I expect Google might have some useful links.

从您的一些评论来看,很明显您没有按照说明在同一位置安装 GNUStep.只需对 gcc.exe 进行文件搜索,即可找到它的安装位置.

From some of your comments, it is clear you haven't installed GNUStep in the same place as the instructions. Just do a file search for gcc.exe to find out where you have installed it.

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /reply/detail/tanhcgekhk
系列文章
更多 icon
同类精品
更多 icon
继续加载