Tuesday, August 9, 2011

Learn Objective C-in Windows


Installation: you should install all below mentioned software.
GNUstep MSYS System Required 0.25.1 none MSYS/MinGW System
GNUstep Core Required 0.25.0 none GNUstep Core
GNUstep Devel Optional 1.1.1 None Developer Tools


save all required source file into "GNUStep/home/user" (user - jfalexvijay) directories.

input:

"test.m"
#import

int main()
{
id a = [Object new];
printf("Welcome");
return 0;
}

"makefile"

include $(GNUSTEP_MAKEFILES)/common.ma​ke
TOOL_NAME = test
test_OBJC_FILES = test.m
include $(GNUSTEP_MAKEFILES)/tool.make

to compile:
$ gcc -o test test.m -I /GNUstep/System/Library/Header​s/ \-L /GNUstep/System/Li
brary/Libraries/ -lobjc -lgnustep-base

to run:
$ ./test.exe

output:

$ gcc -o test test.m -I /GNUstep/System/Library/Header​s/ \-L /GNUstep/System/Li
brary/Libraries/ -lobjc -lgnustep-base
Info: resolving ___objc_class_name_Object by linking to __imp____objc_class_name
_Object (auto-import)
c:/gnustep/mingw/bin/../lib/gc​c/mingw32/4.4.0/../../../../mi​ngw32/bin/ld.exe: wa
rning: auto-importing has been activated without --enable-auto-import specified
on the command line.
This should work unless it involves constant data structures referencing symbols
from auto-imported DLLs.

yourname@Test ~
$ ./test.exe
Welcome
yourname@Test ~
$

No comments: