1. Download necessary packages from official site of GNUStep
| Package | Required? | Stable | Unstable | Notes |
|---|---|---|---|---|
| GNUstep MSYS System | Required | 0.28.1 | - | MSYS/MinGW System |
| GNUstep Core | Required | 0.28.0 | - | GNUstep Core |
| GNUstep Devel | Optional | 1.3.0 | - | Developer Tools |
| Cairo Backend | Optional | 0.22.1 | None | Don't Use. Developer Only |
For the full environment for compiling and running GNUstep. Install the following packages in order:
- First install the gnustep-msys-system package, which contains all the packages required to run GNUstep (shell, graphics libraries, etc).
- Then install gnustep-core, which contains the core GNUstep libraries. If you want to compile and develop your own GNUstep applications.
- Also install the gnustep-devel package.
2. Download Code::Blocks (http://wiki.codeblocks.org/index.php?title=Main_Page)
3. Start CodeBlocks
Adding Filetype Support
1) Go to Settings > Environment...
2) Select Files extension handling and add *.m
3) Go to Project > Project tree > Edit file types & categories...
4) Under Sources, add *.m to the list of filetypes.
3. Start CodeBlocks
Adding Filetype Support
1) Go to Settings > Environment...
2) Select Files extension handling and add *.m
3) Go to Project > Project tree > Edit file types & categories...
4) Under Sources, add *.m to the list of filetypes.
Proper Syntax Highlighting
1) Go to Settings>Editor...
2) Select Syntax highlighting and go to Filemasks.... Add *.m to the list of filetypes. Also needs to remove *.m from Matlab
3) Go to Keywords... (next to Filemasks...) and create a new set (up arrow). Add this to the Keywords:
@interface @implementation @end @class @selector @protocol @public @protected @private id BOOL YES NO SEL nil NULL self
4. Go to Settings > Compiler and debugger...
1) Select GNU GCC Compiler and make a copy it; name it whatever you like, but "GNU GCC Obj-C Compiler" would be the most descriptive. Under compiler Settings, add -fconstant-string-class=NSConstantString to other options. Also to avoid header files not to be found, add the header path in the compiler tab of search directories.
2) Under Linker Settings, explicitly add the libobjc.dll.a and libgnustep-base.dll.a libraries, as the flag tells gcc to include it for us. Or, add -lobjc -lgunstep-base in linker options. To ensure these libraries can be found, the lib search path has to be specified in linker tab of search directories.
3) Under Other Settings, change Compiler logging to Full command line. If ObjC still refuses to build properly for you, you can use this to compare the command line arguments C::B uses against the commands you would use if you were building the program manually on the command line.
4) Under Other Settings, go to Advanced Options. For Link object files to executable and Link object files to console executable, move -o $exe_output to the end of the macros. For reasons beyond my understanding, GCC will sometimes (albeit rarely) complain during complex builds if this isn't the last argument on the line.
5. Specify the compiler for each souce file (*.m and *.h)
1) By default, C::B will select CPP as the default compiler variable for a new source file, and the file will not be compiled or linked to a target. Whenever you add or create a new ObjC source (*.m) in your project, you must right-click on it and go to Properties.... Under advanced, change the compiler variable to CC. Under Build, select both Compile file and Link file.
1) By default, C::B will select CPP as the default compiler variable for a new source file, and the file will not be compiled or linked to a target. Whenever you add or create a new ObjC source (*.m) in your project, you must right-click on it and go to Properties.... Under advanced, change the compiler variable to CC. Under Build, select both Compile file and Link file.
2) Before you close the dialog, go to General and uncheck File is read-only. This will automatically get selected when you change the other options and if you close the dialog before you uncheck it, you'll have to go back and change it, then close and reopen the file in the viewer before you can edit it.
3) When you add a header file (*.h), you'll also need to open up its properties window and change the compiler variable to CC. You don't need to do anything else to it.
The steps of configuration Code::Blocks is referred from http://wiki.codeblocks.org/index.php?title=Installing_Objective-C_Compiler














0 意見:
張貼意見