One, installation of the IDE (Code::Blocks)
We use Code::Blocks as the IDE, its installation package can be downloaded from all over the web, no special requirements for the version. The author uses the version of 16.10 (link: https://pan.baidu.com/s/1l7EtMVWBCffuCVHaF3-tQg password: 85ie)
I will not write the detailed installation details.
second, the installation of the compilation tool (GNUStep)
We need the following six installation packages:
Projectcenter-0.5.0-setup.exe (Http://ftp.gnustep.org/pub/gnustep/binaries/windows/ProjectCenter-0.5.0-setup.exe)
Gnustep-cairo-0.22.0-setup.exe (Http://ftp.gnustep.org/pub/gnustep/binaries/windows/gnustep-cairo-0.22.0-setup.exe)
Gnustep-core-0.22.0-setup.exe (Http://ftp.gnustep.org/pub/gnustep/binaries/windows/gnustep-core-0.22.0-setup.exe)
Gnustep-devel-1.4.0-setup.exe (Http://ftp.gnustep.org/pub/gnustep/binaries/windows/gnustep-devel-1.4.0-setup.exe)
Gnustep-system-0.22.0-setup.exe (Http://ftp.gnustep.org/pub/gnustep/binaries/windows/gnustep-system-0.22.0-setup.exe)
Gorm-1.2.8-setup.exe (Http://ftp.gnustep.org/pub/gnustep/binaries/windows/gorm-1.2.8-setup.exe)
Note: One of the folders to be installed, such as: D:\GNUStep.
III. configuration of the IDE
Okay, we're going to get into the text.
first, start code::blocks. Enter Settings->compiler and Debugger ..., select the GNU GCC Compiler compiler, press the "Copy" button, and rename "GNUstep MinGW Compiler" and save. After entering the other Options page, enter: -fconstant-string-class=nsconstantstring-std=c99
Next
Connector Settings Linker stettings
Add two files to the connection library (link Libraries):
D:\GNUstep\GNUstep\System\Library\Libraries\libobjc.dll.a
D:\GNUstep\GNUstep\System\Library\Libraries\libgnustep-base.dll.a
Maybe your installation address is different from mine, so you can change the address above.
After you set the search directories:compiler (compiler) to D:\GNUstep\GNUstep\System\Library\Headers
Then, add objective-c file type support: Enter Settings->environment ..., select files extension handling add *.m, *.mm
then enter project->project tree->edit file types & categories ..., in sources, add *.m below to the list of file types, Enter Settings->editor ..., select Syntax Highlighting, click the "Filemasks ..." button, add *.m to the end of the popup box, *.mm to the file type.
Click on C + + and select Objective C in the drop-down box.
Iv. Testing
New project, select Empty Project. After that, create the Empty file. Save As MAIN.M (note the suffix named *.m).
Enter the code:
#import <Foundation/Foundation.h> int main (int argc, const char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog(@"hello world");
[pool drain]; return 0;
}
Build (build) and run.
If there is a window showing "Hello World", congratulations, you have successfully built an integrated development environment for OBJECTIVE-C under Windows.
Configuring the OBJECTIVE-C development environment under Windows