views:

85

answers:

2

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.

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!

A: 

Time to cowboy up, and learn some command line compiling.

First, you need to install the GNUStep on your machine. Then, set the appropriate environment variable to point to whereever you installed GNUStep to. Now you should be able to finish the tutorial.

GNUStep is designed to let developers build cocoa applications on a variety of platforms.

Alan
Thanks. I did install GNUStep, both the system and the core packages. How do I set the environment variable, though? I'm not familiar with that terminology. The instructions mention something about a file C:\GNUstep\mingw\bin\gcc.exe, but such a file does not exist in that directory for me.
Nick
It depends on what version of windows you're running on, but http://support.microsoft.com/kb/310519 has a good general overview. Also, that's just an example path. I believe you'll need to install the developer packages if you want gcc.
Alan
Ah, okay. I figured out how to change it. So once I get gcc.exe, I just need to add it to the list of environment variables that are already there? Also, do you know specifically what developer package I'd need to get gcc.exe and exactly where I can download it? I went on gcc.org but was unable to find the proper download. After digging around on there, I followed links to some mirror sites, but the downloads I found were .bz2 and .gz files that my computer couldn't read.Thank you!
Nick
A: 

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.

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.

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

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.

JeremyP
I just did a search for gcc.exe, including in hidden/non-indexed/system, and there were no results. The files in the link provided by the tutorial (http://www.gnustep.org/experience/Windows.html) had slightly different filenames than the ones in the tutorial itself, but I attribute that to the tutorial being older than the latest GNUstep release. I downloaded the first 2 of those files, and chose default for everything.
Nick