在 Windows 上使用 Objective-c 进行 GUI 编程?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7359703/
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
GUI programming with objective-c on Windows?
提问by Muhammad Hewedy
Is it possible to do GUI programming using objective-c on Windows?
是否可以在 Windows 上使用 Objective-c 进行 GUI 编程?
I am noticing that GNUstep contains headers for AppKit
which is found here /GNUstep/System/Library/Headers/AppKit
我注意到 GNUstep 包含AppKit
可在此处找到的标头/GNUstep/System/Library/Headers/AppKit
Should I install Project Center
for that?Is it works? If there a way to write the GUI code by hand?
我应该Project Center
为此安装吗?它有效吗?如果有办法手动编写GUI代码?
EDIT:
EDIT:
I just want to build simple utility GUI apps.
我只想构建简单的实用程序 GUI 应用程序。
Here's the code I wrote:
这是我写的代码:
#import <Cocoa/Cocoa.h>
int main(void)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSView* myView = [[[NSView alloc] initWithFrame:NSMakeRect(10, 10, 100, 100)]autorelease];
[pool release];
return 0;
}
And I got:
我得到了:
$ gcc `gnustep-config --objc-flags` *.m -L /GNUstep/System/Library/Libraries -lobjc -lgnustep-base
HelloGUI.m: In function 'main':
HelloGUI.m:7:10: warning: unused variable 'myView'
C:\Users\mhewedy\AppData\Local\Temp\ccvUXAIj.o:HelloGUI.m:(.data+0xa58): undefined reference to `__objc_class_name_NSView'
collect2: ld returned 1 exit status
The reasons I want to develop this app on windows is:
The reasons I want to develop this app on windows is:
- The Target platform for this app to run on is Windows.
- I don't have mac. (please don't ask me to buy one)
- 此应用程序运行的目标平台是 Windows。
- 我没有mac。(请不要让我买一个)
Thanks.
谢谢。
回答by vin
Yes, it is possible. Check the following links
对的,这是可能的。检查以下链接
http://www.gnustep.it/nicola/Tutorials/index.html
http://www.gnustep.it/nicola/Tutorials/index.html
http://www.gnustep.it/nicola/Tutorials/WindowsAndButtons/index.html
http://www.gnustep.it/nicola/Tutorials/WindowsAndButtons/index.html
To write code you can use notepad or 'Gemas' - a lightweight editor, which can be downloaded from the following link.
要编写代码,您可以使用记事本或“Gemas”——一种轻量级编辑器,可从以下链接下载。
回答by Siva
include this library for linking
包含此库以进行链接
-lgnustep-gui