Saturday, April 23, 2011

Compiling a GNUStep Application under Windows

A friend of mine had some issues compiling a GNUstep program under Windows. I investigated the problem and here is what we have to do .

From the MingW Command windows (MSYS ) I typed

mount

mount will print the information about folders mounted relative to the root.


SAP@SAP-PC ~/pai


$ mount

C:\Users\SAP\AppData\Local\Temp on /tmp type user (binmode,noumount)

H:\GNUstep2\mingw on /mingw type user (binmode)

H:\GNUstep2 on / type user (binmode,noumount)

H:\GNUstep2 on /usr type user (binmode,noumount)

a: on /a type user (binmode,noumount)

c: on /c type user (binmode,noumount)

d: on /d type user (binmode,noumount)

f: on /f type user (binmode,noumount)

g: on /g type user (binmode,noumount)

h: on /h type user (binmode,noumount)

i: on /i type user (binmode,noumount)

j: on /j type user (binmode,noumount)



SAP@SAP-PC ~/pai

 
I have installed GNUstep @ H:\GNUstep2 and the folder is mapped to /usr ( and / )

From this I could get the Library Headers ( Foundation kit ) @

/usr/GNUstep/System/Library/Headers

and the Libraries are available @

/usr/GNUstep/System/Library/Libraries

Once we have figured out Path for headers and libraries , we need to link following libraries

-lobjc  , -lgnustep-base , -lgnustep-gui

The Complete program and the instructions to compile it is given below


///////////////////////////////////////
// Fstring.m
// 
// On a Windows 7
// --------------
// gcc -o test.exe FString.m 
//        -fconstant-string-class=NSConstantString
//        -I /usr/GNUstep/System/Library/Headers
//        -L /usr/GNUstep/System/Library/Libraries
//        -lobjc -lgnustp-base -lgnustep-gui -enable-auto-import
//         
//
//
//
//
#import <Foundation/Foundation.h>

int main( int argc , char **argv )
{     

    NSString *r = @"Hello World....";   
    NSLog(@"Objective C %@ \n ",r);   
    return 0;
}


0 comments: