From: http://blog.csdn.net/hulefei29/archive/2010/02/21/5314018.aspx
Objective-C has almost become Apple's patent. You can compile the objective-C program directly on Apple's xcode, but there are few compilation tools on the Windows platform, not many people use this language. Today, I suddenly saw a post posted on the Internet. I can compile objective-C on the Windows platform and tried it with curiosity. I didn't expect it to succeed. Now I will share with you my experience on how to build the objective-C compiling platform.
1. Install gnustep
Gnustep Windows Installer provides a simulated development environment for Object-C on the Windows platform. There are a total of four software packages, including gnustep system and gnustep core, gnustep devel and Cairo backend are optional. Only the first two installation methods are enough.
2. compile objective-C code
After the installation is complete, run shell in the gnustep option in the Start menu to open the command line. Directly go to the C: \ gnustep \ home \ Administrator (my administrator may be different) directory in windows, here, you can use your favorite tools (now the ultraedit and notepad ++ editor seem to be able to highlight Code) to compile the object-C program.
For example: helloworld. m
# Import <Foundation/Foundation. h>
Int main (INT argc, const char * argv [])
{
NSAID utoreleasepool * Pool = [[NSAID utoreleasepool alloc] init];
Nslog (@ "Hello world! ");
[Pool drain];
Return 0;
}
3. Configure Environment Variables
This step is important. Gnustep. Sh is used to set the gnustep development environment variables. If it is not executed, there will be many header files, library files, and commands cannot be found.
After the source code is written in a directory, compile a make configuration file named gnumakefile. The content is
Include $ (gnustep_makefiles)/common. Make
Tool_name = test
Test_objc_files = helloworld. m
Include $ (gnustep_makefiles)/tool. Make
You can modify the simhei section above.
Then
Make
After the command is run successfully, an OBJ directory is added, which contains the executable files and. O files you want.
OK.