Build OBJECTIVE-C development environment under Windows environment
For now, if you really want to use Xcode to run the OBJECTIVE-C program, then you can use the virtual machine to install Mac OS X or a black Apple (installed on the PC on the Apple system, not recommended), but both of these methods are a bit cumbersome, the following describes GNUstep and code Blocks to achieve this, the concrete method is as follows.
Download the required tools on my Cloud disk: Link: http://pan.baidu.com/s/1i34b8wP Password: wd9e
After decompression, follow the order of installation
Gnustep-core-0.28.0-setup.exe
Gnustep-msys-system-0.28.1-setup.exe
Gnustep-system-0.24.2-setup.exe
Gnustep-cairo-0.22.1-setup.exe
Gnustep-devel-1.4.0-setup.exe
Codeblocks-13.12-setup_2.exe
Here I have the above 5 is installed on the D-disk, the following will be used to this path, the last one can be arbitrarily installed in a certain drive letter
Through the configuration of code blocks, step by step to complete the construction of the OBJECTIVE-C development environment. Codeblocks, you can see such a picture:
First step: Configure the compiler
Enter Settings->compiler anddebugger..., select the GNU GCC Compiler compiler, press the "Copy" button, and rename "GNUstep MinGW Compiler" and save.
Then enter the other Options page, input : (Need to delete the original things)
-fconstant-string-class=nsconstantstring-std=c99
Step Two: Connector settings linkerstettings
Add two files to the connection library (link Libraries).
They are below the D:\GNUstep\GNUstep\System\Library\Libraries:
Libgnustep-base.dll.a
Libobjc.dll.a
(Need to delete the original thing)
Step Three: Specify Search directory Searchdirectories(requires pre-installed GNUstep)
1) Compiler(compiler) set to D:\GNUstep\GNUstep\System\Library\Headers; (need to delete old things)
2) Linker(connector) set to D:\GNUstep\GNUstep\System\Library\Libraries; (need to delete the original thing)
Fourth step: Add objective-c File type support
1) enter settings->environment ... , select Files extension handling to add *.m.
2) Enter project->projecttree->edit file types & Categories ... , in Sources, add *.m to the file type list below.
3) Enter Settings->editor ... , select Syntaxhighlighting, and click "Filemasks ...." button to add *.m to the file type at the end of the popup box .
4) click "Keywords ..." button (close to filemasks ...) Button ) to add the following object-c keyword to the editkeywords list:
@interface @implementation @end @class @selector @protocol @public @protected ID BOOL YES NO SEL nil NULL Self |
4. Code Testing
Once the above development environment configuration is complete, you can begin the code test.
First, create a new project, select file->new->project ..., a project type window will appear, select Console application, then follow the construction guidelines to establish a mytest project, and rename the Main.c file to MAIN.M, enter the following code:
1 #import <Foundation/Foundation.h>23int main (intconst Char * argv[]) {4 NSLog (@ "Hello, world! " ); 5 return 0 ; 6 }
Then start the compile run:buid–> Run ... If the following window appears, congratulations, you have successfully built the OBJECTIVE-C integrated development environment under Windows.
Build OBJECTIVE-C development environment under Windows environment