Solved

Installed GNUStep, have msys.bat how can I add CD "C:\My Documents\ObjC"

Posted on 2010-08-13
89
1,188 Views
Last Modified: 2013-12-13
I've just installed GNUStep so I can do some Objective C on my Windows XP while I'm away from home / my Mac Mini.

There's a shortcut to shell, which calls Msys.bat

How can I default shell to CD "C:\My Documents\ObjC"

I'm always going to was to do this to compile programs
0
Comment
Question by:mindwarpltd
  • 45
  • 44
89 Comments
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33428523
Try it first. It is not the same as Objective-C 2.0 and Xcode on your Snow Leopard.
Can you imagine a case when you will write a Windows applications in pure C++ on Mac OS X computer? No Win32 API available, right? So you hope that at least printf("Hello, world"); will work? Same with GNUStep. Objective-C without Cocoa is not attractive at all.
 
You can write a program in a text editor and then compile it in the command prompt window.
I hope, I'm wrong. I tried it few months ago for an hour and I cannot say I liked it. I simply un-installed it.
Again, I hope, I'm wrong and someone will advice here how to work with it. If not, maybe you will say what you think about it.

0
 

Author Comment

by:mindwarpltd
ID: 33428538
I have tried, I want to write some core functions.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33428661
Core? For Windows? On Windows computer you can write a "core function" for Windows. You mean a core of project probably. Even in this case, in Xcode, any class you make begins as:
@interface Hello: NSObject
{
}
It does not compile in GNUStep. NSObject does not exist there. Without NSObject you lose a lot.
Try yourself. Open Notepad++ (whatever you have) and write a helloWorld program (or any core function).

On Wiki you can find how to install GNUStep on Windows (if you have a trouble with it):
Installation on Windows
http://wiki.gnustep.org/index.php/Installation_on_Windows

This is a shorter article and it has a hello example in the end (it works):
Installing and using GNUstep and Objective-C on Windows
http://www.techotopia.com/index.php/Installing_and_using_GNUstep_and_Objective-C_on_Windows

It's all work. I tested all that few months ago.

You may need Cygwin or MinGW. I have tried Cocoatron too. It has much more than GNUStep.
http://www.cocotron.org/

Do not forget that the Objective-C run-time is different even for Leopard and Snow Leopard. A lot of nice Objective-C features are presented only in the 64-bit.
After Mac OS X it's somehow not convenient to work on a Windows computer. At least, it is correct about Objective-C programming. Better to use C# for Windows.

I hope, I'm wrong. So someone will fix me. I really wish you good luck. Please let me know if you will get something good, a better than my experience with it.


0
 

Author Comment

by:mindwarpltd
ID: 33428714
I followed this earlier
http://www.roseindia.net/iphone/objectivec/compiling-objective-c.shtml

I had hoped to write some sqlite functions and get all my sql embedded in the code.
Although I haven't looked for an sqlite library for windows.

I figured I'd have problems finding an alternative to xcode on windows, but thought I'd be able to do the data access stuff as mentioned.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33429013
I wish you good luck.

It is a very short article. I passed that point. I even wrote something like you say "core" (not about my sql).
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33429031
0
 

Author Comment

by:mindwarpltd
ID: 33429088
no not my sql

sqlite, theres libraries in xcode.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33429235
how I know (I'm not a database programmer), you can work with sqllite from standard C++. So you may make such code in Visual Studio.
Please let me know if you will have a better results than me.
0
 

Author Comment

by:mindwarpltd
ID: 33429281
Hmmm thats an idea.
0
 

Author Comment

by:mindwarpltd
ID: 33429334
Still might have a look for sqlite for gnustep
0
 

Author Comment

by:mindwarpltd
ID: 33429342
Oh just realised I don't have vs on my laptop as my laptop is old and slow, looking for something lighter, gnustep would have been great
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33429834
Just found this article:
Compile Objective-C Programs Using gcc
http://blog.lyxite.com/2008/01/compile-objective-c-programs-using-gcc.html

Seems like this guy with GNUStep compiles a foundation tool program: with a class derived from NSObject.
0
 

Author Comment

by:mindwarpltd
ID: 33430188
Cool, have you verified this ?

Have you found sqlite too :P
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33430290
I have only Mac today. I attached a code that I compile without Xcode, in the terminal with gcc as:
gcc -arch i386 test.m -lobjc -o test

Them I launch the app:
./test

and it even works.

(-arch i386 it's because I'm on the 64-bit)

That's all I can test today on Mac from that article.

#include <objc/Object.h>
#include <stdio.h>
#include <stdio.h>

@interface Test : Object
{
}

- (void) sayHello;

@end;

@implementation Test


- (void) sayHello
{
  printf("Hello\n");
}

@end

int main(void)
{
  id t;
  t = [Test new];
  [t sayHello];
  [t free];
  return 0;
}

Open in new window

0
 

Author Comment

by:mindwarpltd
ID: 33430332
What about your compiler flag / command line ?
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33430372
You see it in the previous comment:
gcc -arch i386 test.m -lobjc -o test

I think, you need: gcc test.m -lobjc -o test
You have installed Mingw? Do you have gcc?
0
 

Author Comment

by:mindwarpltd
ID: 33430471
yes I have gcc

Hmmm I get...

Administrator@iron ~
$ cd "C:\My Documents\ObjC"

Administrator@iron /c/My Documents/ObjC
$ gcc test.m -lobjc -o test
test.m:1:25: error: objc/Object.h: No such file or directory
test.m:6: error: cannot find interface declaration for 'Object', superclass of '
Test'
test.m: In function 'main':
test.m:26: warning: 'Test' may not respond to '+new'
test.m:26: warning: (Messages without a matching method signature
test.m:26: warning: will be assumed to return 'id' and accept
test.m:26: warning: '...' as arguments.)
test.m:28: warning: no '-free' method found

Administrator@iron /c/My Documents/ObjC
$

0
 

Author Comment

by:mindwarpltd
ID: 33430514
I took the other includes out and left

#include <stdio.h>

But I got the same errors expect the first one with Object.h
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33430564
you need to setup the environment on your computer. All LIB, PATH, etc.
One of the links above explains how to do that on Windows.
http://www.techotopia.com/index.php/Installing_and_using_GNUstep_and_Objective-C_on_Windows
There is full "Hello" example.

Or use full path to this library.
0
 

Author Comment

by:mindwarpltd
ID: 33431678
User variables
PATH
C:\GNUstep\mingw\bin;C:\GNUstep\GNUstep\System\Tools

System variables
PATH has stuff in too

I don't have a LIB or ALL LIB  
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33431746
For a test use the full path to the libraries in the command line. It will compile.
0
 

Author Comment

by:mindwarpltd
ID: 33431772
Which command line ?
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33431829
gcc the_file_with_your_code -lobjc

If you on a Windows computer, in the command prompt go to the folder with your program and type this line above. It will look like:
>c:\mingw\bin\gcc my_program.m -lc:\gnustep\lib\objc
0
 

Author Comment

by:mindwarpltd
ID: 33431920
Hmmm, think this should have worked, have I missed something ?

C:\My Documents\ObjC>gcc test.m -lc:\gnustep\lib\objc
test.m:4: error: cannot find interface declaration for 'Object', superclass of '
Test'
test.m: In function 'main':
test.m:24: warning: 'Test' may not respond to '+new'
test.m:24: warning: (Messages without a matching method signature
test.m:24: warning: will be assumed to return 'id' and accept
test.m:24: warning: '...' as arguments.)
test.m:26: warning: no '-free' method found
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33432047
It's a progress.
I saw same errors today on Snow Leopard (64 bit). The fix was -arch i386. Try to use it. After gcc add this parameters.
0
 

Author Comment

by:mindwarpltd
ID: 33432178
Is this what you meant ?

C:\My Documents\ObjC>gcc -arch i386 test.m -lc:\gnustep\lib\objc
gcc: i386: No such file or directory
cc1obj.exe: error: unrecognized command line option "-arch"

C:\My Documents\ObjC>gcc test.m -arch i386 -lc:\gnustep\lib\objc
gcc: i386: No such file or directory
cc1obj.exe: error: unrecognized command line option "-arch"
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33432288
That worked on my Mac. I've told: I'm on 64-bit and have to use this -arch i386 to compile the GNUStep Objective-C program. Strange that your gcc does not recognize these options.
Check:
gcc -v
and tell me what is the version.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33432350
You can try to add that:
-fgnu-runtime

Check if you can compile the attached code.
#include <stdio.h>
#include <objc/objc.h>

int main (void)
{
 
  return 0;
}

Open in new window

0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33432389
Seems like the command line should be:
gcc -fgnu-runtime  test.m  -lobjc

Of course with the correct path for the gcc, m-file and the library.

0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33432439
0
 

Author Comment

by:mindwarpltd
ID: 33432457
C:\My Documents\ObjC>gcc -fgnu-runtime test.m -lobjc
test.m:4: error: cannot find interface declaration for 'Object', superclass of '
Test'
test.m: In function 'main':
test.m:24: warning: 'Test' may not respond to '+new'
test.m:24: warning: (Messages without a matching method signature
test.m:24: warning: will be assumed to return 'id' and accept
test.m:24: warning: '...' as arguments.)
test.m:26: warning: no '-free' method found
0
 

Author Comment

by:mindwarpltd
ID: 33432482
C:\My Documents\ObjC>gcc `gnustep-config --objc-flags` -o test test.m -L c:/GNUs
tep/GNUstep/System/Library/Libraries -lobjc -lgnustep-base
gcc: `gnustep-config: No such file or directory
cc1obj.exe: error: unrecognized command line option "-fobjc-flags`"
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33432543
Which Windows version you use? I have here a computer, hopefully, with Windows XP. If you have the same I will install GNUStep. :)
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33432555
gcc test.m -lobjc
for test.m:

#include
#include

int main (void)
{
 
  return 0;
}

works?
0
 

Author Comment

by:mindwarpltd
ID: 33432680
Yes windows XP
0
 

Author Comment

by:mindwarpltd
ID: 33432689
C:\My Documents\ObjC>gcc test2.m -lobjc
test2.m:2:23: error: objc/objc.h: No such file or directory
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33432725
add the path before objc. We did it once. If you cannot compile this test.m we cannot continue. Your compiler does not find the objective-c. Should be c:\ObjC\objc something like that.

0
 

Author Comment

by:mindwarpltd
ID: 33432830
I have a C:\My Documents\ObjC which has my m files in.

I did a search on the GNUstep folder heres the results, not sure what path to use ?
objc-files.png
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33432884
C:\My Documents\ObjC
0
 

Author Comment

by:mindwarpltd
ID: 33433016
Sorry can you give me the command line, I don't see how this would work ?
0
 

Author Comment

by:mindwarpltd
ID: 33433065
Heres my my docs\objc files
mydocs-objc.png
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433067
Actually it took 5 minutes to install GNUStep exactly as it is described here:
http://www.gnustep.org/experience/Windows.html
I found this link from here: http://www.techotopia.com/index.php/Installing_and_using_GNUstep_and_Objective-C_on_Windows
I iunstalled MSYS and the the Core. Then I launched the shell. It is in Start->All Programs->GNUStep->Shell.
now gcc compiler can be launched. I used vi to type a small test.m file:
#include <stdio.h>
int main(void)
{
  printf("hello\n");
  return 0;
}
then typed: gcc test.m. Just to test. This is actually c program. I got a.exe. It works.

gnustepshell.JPG
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433095
Next step. I modified test.m file. It still compiles and works. All is attached.
#include <objc/object.h>

#include <stdio.h>



int main(void)

{

  printf("Hello, Objective-C\n");

  return 0;

}

Open in new window

gnustepshell1.JPG
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433130
Next step
#include <objc/object.h>

#include <stdio.h>



@interface Test : Object

{

}

- (void)sayHello;

@end



@implementation Test



- (void) sayHello

{

   printf("Hello from Objective-C class\n");

}



@end



int main(void)

{

  id t;

  t = [Test new];

  [t sayHello];

  [t free];

  return 0;

}

Open in new window

gnustepshell2.JPG
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433148
You know - thank you. This time GNUStep works as promissed for me. Now I suspect that we can compile a foundation tool on Windows XP. :) Pay attention that the output files are standard Windows executables.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433182
When I installed GNUStep I did change any default parameter. The foilder is C:\GNUStep. In this folder 'home'. In this folder I se ethe folder with my uiser name. It's like HOME on Mac. In this folder you can create files with any Windows editor. For example, with Notepad++.
 
0
 

Author Comment

by:mindwarpltd
ID: 33433210
So what do I need to do ?
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433259
Foundation tool is also works. The command line is long:
$ gcc `gnustep-config --objc-flags` -L /GNUstep/System/Library/Libraries test1.m -o test1.exe -lgnustep-base -lobjc
 

#import <Foundation/Foundation.h>



int main (int argc, const char * argv[])

{

        NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];



        NSLog (@"Hello. It's Foundation Tool");

        [pool drain];

        return 0;

}

Open in new window

gnustepshell3.JPG
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433288
>>So what do I need to do ?
1. Install GNUStep.
2. Launch a text editor and type of the samples from this thread and save it in /GNUStep/home/<user name> folder.
3. Launch Shell. It is in Start->All Programs->GNUStep->Shell.
4. In the shell type gcc.... - the command to compile the file you just saved. All these gcc strings are in this thread.
 
0
 

Author Comment

by:mindwarpltd
ID: 33433292
Hmmm, I must have some enviromental variables, or something wrong then ?

C:\My Documents\ObjC>gcc `gnustep-config --objc-flags` -L /GNUstep/System/Librar
y/Libraries test1.m -o test1.exe -lgnustep-base -lobjc
gcc: `gnustep-config: No such file or directory
cc1obj.exe: error: unrecognized command line option "-fobjc-flags`"
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433354
no. Everything's set when you launched the shell. It is a bat-file.
I'm afraid you didn't install something.
Download first two links from here:
http://www.gnustep.org/experience/Windows.html
Uninstall everything you have about GNUStep.
Then install - the order is important.
0
 

Author Comment

by:mindwarpltd
ID: 33433389
This is actually the page I followed I downloaded and installed in this order...

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

I didn't install the last one... Cario backend
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433406
No. You need to install GNUStep MSYS System and GNUStep Core. The order is important. So uninstall and install again.
0
 

Author Comment

by:mindwarpltd
ID: 33433450
Thats the order I did them, I didn't have gcc until I installed GNUstep Devel.

I installed

GNUstep MYSUS System  then
GNUstep Core then
GNUstep Devel
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433495
I didn't install GNUStep Devel.
As you wish, it's your computer. :)
0
 

Author Comment

by:mindwarpltd
ID: 33433501
Huh ?

What do I do ?
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433552
Whatever you think is right. I've said what I think. So now it is your problem to decide. :)
1. Uninstall everything GNUStep related from your Windows XP computer.
2. Install GNUstep MSYS System. No changes in the installation wizard.
3. GNUstep Core. No changes in the installation wizard.
4. Launch Shell. Start->All Programs->GNUStep->Shell.
5. In the shell type gcc -v. It will show you the version number. I see gcc version 3.4.5 .

Other option: invite me to visit you. :)
0
 

Author Comment

by:mindwarpltd
ID: 33433615
OK, I've uninstalled and now on point 2, 2 secs
0
 

Author Comment

by:mindwarpltd
ID: 33433645
Ok, I followed those 5 points exactly...

Setting up GNUstep Environment.

Administrator@iron ~
$ gcc -v
sh: gcc: command not found

Administrator@iron ~
$
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433666
Do you see it in the GNUStep shell?
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433670
Did you have mingw installed before?
0
 

Author Comment

by:mindwarpltd
ID: 33433722
Yes I have GNUstep

Setting up GNUstep Environment...

Administrator@iron ~
$ gcc -v
sh: gcc: command not found

Administrator@iron ~
$


No I dont have mingw installed now, it would have only been installed when I installed GNUstep.

The only other thing which seems relevant to mention is GNU Aspell, but I dont think that relevant.

Any further ideas?

0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433736
No.
I'm leaving. I have no idea. Sorry. Good luck.
0
 

Author Comment

by:mindwarpltd
ID: 33433763
Oh dear :(

I'll try another machine tomorrow, thanks, I will post back to see how it goes.
Maybe theres something odd about my laptop.

Was your machine clean before you installed ?
No env variables etc too ?
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433791
No. I installed everything on my old HP desktop. It's really old. It was with Windows XP from the beginning, from the shop. I have a million of SDK's, studios, apps, drivers,... installed on it. The download, installation and these 3 samples took me about 15 minutes.
0
 

Author Comment

by:mindwarpltd
ID: 33433856
Hmmm, so you could have had something else installed or a env sys var too
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433891
I checked Add/Remove Programs before the installation.
Read here: http://www.techotopia.com/index.php/Installing_and_using_GNUstep_and_Objective-C_on_Windows
It's exactly what I did.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33433910
In the previous round you had gcc working but there was a problem with the libraries. You can try to install this Devel, if it helps. And try to compile.
0
 

Author Comment

by:mindwarpltd
ID: 33434013
Ok, I tried yet another uninstall and reinstall on my laptop and still no joy.
I noticed it created another GNUstep sub folder, so I copied that into the root and that didnt work either.

I think I'll try installing the exact versions in that last article.

Where are you UK ?

Thanks, I'll report back.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33434046
Which subfolder? It's installed on C drive. I have C:\GNUStep and C:\MINGW. I didn't change anything n the installation wizard.
>>I think I'll try installing the exact versions in that last article.
Of course.
0
 

Author Comment

by:mindwarpltd
ID: 33435650
OK, I now have

$ gcc -v
Reading specs from C:/GNUstep/mingw/bin/../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc --with-gnu-ld --wi
th-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --dis
able-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --d
isable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --with
out-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enabl
e-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw-vista special r3)


:)

I went back and tried the command line before we discovered I had a gcc problem and this has the same error too.

C:\My Documents\ObjC>gcc `gnustep-config --objc-flags` -L /GNUstep/System/Librar
y/Libraries test1.m -o test1.exe -lgnustep-base -lobjc
gcc: `gnustep-config: No such file or directory
cc1obj.exe: error: unrecognized command line option "-fobjc-flags`"
0
 

Author Comment

by:mindwarpltd
ID: 33435654
Ahhh but

Administrator@IRON ~
$ cd "c:\my documents\objc"

Administrator@IRON /c/my documents/objc
$ gcc `gnustep-config --objc-flags` -L /GNUstep/System/Library/Libraries test1.
m -o test1.exe -lgnustep-base -lobjc
Info: resolving ___objc_class_name_NSAutoreleasePool by linking to __imp____objc
_class_name_NSAutoreleasePool (auto-import)
Info: resolving ___objc_class_name_NSConstantString by linking to __imp____objc_
class_name_NSConstantString (auto-import)
C:\GNUstep\mingw\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\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.
Administrator@IRON /c/my documents/objc
$
0
 

Author Comment

by:mindwarpltd
ID: 33435656
And

C:\My Documents\ObjC>test1
2010-08-14 09:18:20.674 test1[2664] Hello. It's Foundation Tool

C:\My Documents\ObjC>
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33435662
Great!
Congratulations.
0
 

Author Comment

by:mindwarpltd
ID: 33435663
I tried the example before that....

Administrator@IRON /c/my documents/objc
$ gcc `gnustep-config --objc-flags` -L /GNUstep/System/Library/Libraries test.m
 -o test.exe -lgnustep-base -lobjc
test.m:5: error: cannot find interface declaration for `Object', superclass of `
Test'
0
 

Author Comment

by:mindwarpltd
ID: 33435668
The code from this post 33433130 above
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33435682
Read the error message: Object is the superclass and the compiler does not find the headers.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33435684
Anyway, you don't need this example. You need the one you have compiled - with the Foundation imported.
Have a nice weekend.
0
 

Author Comment

by:mindwarpltd
ID: 33435686
Isn't there a command line which will do everything ?
0
 

Author Comment

by:mindwarpltd
ID: 33435702
Any ideas about sqlite ?
0
 

Author Comment

by:mindwarpltd
ID: 33436117
Ah lol, you haven't answered the original question :)
0
 

Author Comment

by:mindwarpltd
ID: 33436213
I'm trying to put some basic code together, without much look, any ideas ?
#import <Foundation/Foundation.h>

@interface Test : NSObject
{
}

- (void) fred;
@end;

@implementation Test
- (void) fred {
{
  printf("Hello\n");
}
@end

int main (int argc, const char * argv[])
{
        NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

  	id t;
  	t = [Test new];
  	[t fred];
  	[t free];
  
        NSLog (@"Hello. It's Foundation Tool");
        [pool drain];
        return 0;
}

Open in new window

0
 

Author Comment

by:mindwarpltd
ID: 33436310
Ah found this, a good example which compiles and runs without errors :)

Now what do you think about sqlite ?
#import <Foundation/Foundation.h>
 
 
/* Interface */
@interface Fraction: NSObject 
{
	int numerator;
	int denominator;
}
 
-(void) print;
-(void) setNumerator: (int) n;
-(void) setDenominator: (int) d;
-(void) dealloc;
@end
 
 
/* Implementation */
@implementation Fraction;
-(void) print
{
	NSLog (@"The value of the fraction is %i/%i", numerator, denominator);
	
}
 
-(void) setNumerator: (int) n {
	numerator = n;
}
 
-(void) setDenominator: (int) d {
	denominator = d;
}
 
-(void) dealloc {
	NSLog(@"Release called. Deallocating memory...");
	[super dealloc];
}
@end
 
int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
 
	Fraction *myFraction = [[Fraction alloc] init];
	
	// Set fraction to 3/4
	[myFraction setNumerator: 3];
	[myFraction setDenominator: 4];
	
	// the 'print' method was never called, decided to put the message there
	// Display the fraction
	[myFraction print];
	
        //avoid memory leak with release and super delloc
	[myFraction release];
    [pool drain];
    return 0;
}

Open in new window

0
 

Author Comment

by:mindwarpltd
ID: 33436341
If you can tell me how can I default shell to CD "C:\My Documents\ObjC", which was the original question, I'll accept your solution.

I think the sqlite is another question.

Thanks
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33436490
Is it a weekend? :)
>>default shell to CD "C:\My Documents\ObjC"
What do you mean? If you need to change the folder use:
cd "C:\My Document\Objc"
Your current folder will be "C:\My Document\Objc"
It's correct for Windows batch-file and for the bash-shell on Mac OS X.

To see the current folder in the GNUStep shell type pwd:
$pwd

To change folder use cd. Go to the root:
$ cd /

One level up: cd ..

ls will show the content:
$ ls

I do not know what you mean with this "c:/my document/objc". If it your working folder, make it in the GNUStep. It will be more convenient to compile the programs. It's supposed to work in this way. It is a shell from GNUStep. When you launch it sets up all environment variables.

If in the Shell you will type ls C: you will see the content of C. You can go to My Documents, but it looks, probably, so:
"c:\Documents and Settings\\My Documents\ObjC".
so you can use it with cd command.

In C:\GNUStep\etc you can find your profile files and can modify them. But It is not recommended. I'd say, do not touch them. At least not now. in 'profile' you will see the HOME folder. It's correct. It behaves exactly as bash-shell on Mac by default.

Feel free to delete this question, if you think that this thread didn't help you. Moreover, I'd prefer that way instead of seeing grade "C" or "B" for my answers.
0
 

Author Comment

by:mindwarpltd
ID: 33436539
c:\My Documents\ObjC Is the code folder.

I just wanted the shell to default to that folder so I didn't have to do CD "C:\My Documents\ObjC" everytime I open shell.
0
 

Author Comment

by:mindwarpltd
ID: 33436549
* c:\My Documents\ObjC Is my code folder.
0
 
LVL 33

Expert Comment

by:pgnatyuk
ID: 33436597
1. Find file "profile" in GNUStep/etc folder.
2. Make a back-up copy of this file.
3. In the end of this file you will see cd "HOME". Modify it for whatever you want. For example:
cd "C:|My Documents\ObjC"


0
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 500 total points
ID: 33436600
there is:
cd "$HOME"
You need:
cd "C:\My Documents\ObjC"
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This is about my first experience with programming Arduino.
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
Viewers will learn how to use the Hootsuite Dashboard.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now