Compile objective-C in Windows

Source: Internet
Author: User
Tags cairo

Http://www.gnustep.org/experience/Windows.html

Ftp://ftpmain.gnustep.org/pub/gnustep/binaries/windows
Download from the above website
Gnustep-core-0.23.1-setup.exe
Gnustep-system-0.23.0-setup.exe
Gorm-1.2.10-setup.exe
SystemPreferences-1.1.0-setup.exe
Note that all the latest versions are available.
After the installation is completed, it is all the way to next installation.
Assume that you have mounted the disk D,
> Code Where should I write it?
Then you can write the code wherever it is written. Put it in C.
> How to generate and run
Suppose you write Program The name is hello. m, which is under C.
Run the following command to compile the program,
D: \ gnustep \ mingw \ bin \ gcc.exe hello. m-o hello.exe-I d: \ gnustep \ System \ library \ headers-l D: \ gnustep \ System \ library \ libraries-lobjc-fobjc-exceptions-lgnustep-base-fconstant-string-class = nsconstantstring-enable-auto-Import
Long is a little longer, but it is easy to understand. Simply put,
The most advanced thing is to define gcc.exe, which you must know.
The following-I XXX and-l XXXX refer to the header files and libraries used during compilation,
It mainly involves some cocoa libraries.
There is a bunch of flags, that is, the compilation options. The names are all split.
> I Don't Know Where To write the code.
> Is a TXT document created or another tool used?
After reading the above compilation command, I think you already know how to write it,
> Can I recommend
Have you used Vim? If it is used, its benefits will not be discussed much.
I'm using it, custom hotkey,
A F8 will be compiled in the past, a C-F8 will see the running results,
Do not compile and run it in cmd.
If not, ue, editplus, as long as there are objective C syntax prompts.
> Is a TXT document created or another tool used?
To put it bluntly, it's a C program. Of course, it's in TXT format.
Well, the key point is that installation and compilation have already been written to you. Please study it again.
PS. By the way, the OC in this environment does not support 2.0 features,
Directly speaking, OC attribute operations are not supported,
That is, the @ property tag cannot be identified.

Bytes ----------------------------------------------------------------------------------------------------------------------------

Bytes ----------------------------------------------------------------------------------------------------------------------------

Bytes ----------------------------------------------------------------------------------------------------------------------------

Transferred 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 * ARG V [])
{< br> 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.

Written in a directorySource codeLater, 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.

Bytes ----------------------------------------------------------------------------------------------------------------------------

Bytes ----------------------------------------------------------------------------------------------------------------------------

Bytes ----------------------------------------------------------------------------------------------------------------------------

Install gnustep

Original address http://i4y.jsfirm.cn/page/read/127

Since there is no Mac version, you can only practice objective-C syntax on Linux. The installation process is not smooth. The platform used here is still Debian, and Windows is also acceptable,

For more information about gnustep, go to the official website. In short, it is a cross-platform objective-C compiling and running environment. The installation is as follows:

# Apt-Get install gnustep

# Apt-Get install gnustep-devel

# Apt-Get install libgnustep-base-Dev

# Apt-Get install gnustep-Games

In this way, the installation is complete. (The above installation package can be put together. After one installation, do not underestimate the packages. Shitou took a lot of effort to find it, to express the search pain, please keep it long, ^ _ ^)

Then the configuration is configured, firstly:

# Echo 'export LIBRARY_PATH =/usr/lib/gnustep/system/library/libraries'> ~ /. Profile

# Echo 'export objc_include_path =/usr/include/gnustep/headers'> ~ /. Profile

# Source ~ /. Profile

Then execute the gnustep. Sh script to automatically load other environment paths:

# Chmod + x/usr/share/gnustep/makefiles/gnustep. Sh

# Source/usr/share/gnustep/makefiles/gnustep. Sh

Also add the. profile file so that the user can load it when logging on to the system.

# Echo 'source/usr/share/gnustep/makefiles/gnustep. Sh'> ~ /. Profile

In this way, the setting is complete, and an objc program is written for testing. During the test, the nxconstantstring or another error may be reported. The method is:

# Gcc-O hello. M-fconstant-string-class = nsconstantstring-lobjc-lgnustep-Base

In this way, the success is achieved. Now, we will start to officially learn objective-C .........

Bytes ----------------------------------------------------------------------------------------------------------------------------

Bytes ----------------------------------------------------------------------------------------------------------------------------

Bytes ----------------------------------------------------------------------------------------------------------------------------

Use objective-C and cocoa on Windows

Transferred from:Http://www.cnblogs.com/2018/archive/2010/12/25/1916764.html

I recently developed the iPhone and used cocoa. I feel that the cocoa design is exquisite and the objecitive-C syntax is very simple and easy to use. Therefore, I want to check whether there is a runtime environment in windows, this makes it easy to use. Otherwise, it will only be used on Mac. It is troublesome to install virtual machines or purchase hardware. I searched for some information and found some tools in this regard.

Cross-platform cocoa

Http://stackoverflow.com/questions/2049099/cocoa-programming-on-windows

Gnustep

Http://www.gnustep.org/

The purpose of this project is to create a free and open version of the cocoa (formerly known as nextstep/openstep) APIs and tools for as your platforms as possible.

Gnustep provides a robust implementation of the appkit and foundation libraries as well as the development tools available on cocoa, including Gorm (the interfacebuilder) and projectcenter (projectbuilder/xcode ). gnustep currently supports Unix (GNU/Linux and GNU/Hurd, Solaris, NetBSD, OpenBSD, FreeBSD, Darwin) and Windows.

It can be seen that this open-source project has constructed a series of tools with xcode interfacebuilder and objective-C cocoa runtime environments.

Http://www.nongnu.org/gstutorial/zh_tw/index.htmlgnustepchinese document and reference

Http://ftp.gnustep.org/pub/gnustep/binaries/windows/ this can download the Windows version of each execution File

Cocotron

Http://www.cocotron.org/

The objective of the cocotron project is to implement a cross-platform objective-c api similar to Apple cocoa. Including appkit, foundation, and objective-C Runtime libraries and other function libraries, such as CoreGraphics and corefoundation.

Http://www.cocoachina.com/ B? P = 144

Compared with gnustep, cocotron can be used as a whole environment experience and learning for development.

Install and use gnusetp

Http://ftp.gnustep.org/pub/gnustep/binaries/windows/ in this path can download windows under the execution file, the upper directory can see the various versions of the code and documentation and so on Content

Install the latest version

Http://www.gnustep.org/experience/Windows.html

Objective-CAnd cocoaFramework compilation environment

Gnustep-msys-system-0.25.1-setup.exe

Gnustep-core-0.25.0-setup.exe

Gnustep-devel-1.1.1-setup.exe

Gnustep-cairo-0.22.1-setup.exe

Similar to interface BuilderInterface Design Tools

Gorm-1.2.12-setup.exe

Example Tool

Gnustep-examples-1.3.0.tar.gz

Gworkspace-0.8.8.tar.gz

ProjectCenter-0.6.0.tar.gz

SystemPreferences-1.1.0-1-setup.exe

In the previous version of projectcenter, You need to compile and use it by yourself. [relevant documentation in the Code]

Http://www.jaysonjc.com/programming/objective-c-programming-in-windows-gnustep-projectcenter.html

Is a function description that uses an existing version, use the following:

Gnustep-system-0.22.0-setup.exe

Gnustep-core-0.22.0-setup.exe

Gnustep-devel-1.0.0-setup.exe

Gorm-1.2.8-setup.exe

ProjectCenter-0.5.0-setup.exe

Install the project tool and interface tool in the compiling environment in the above sequence.

[After installing the project (windows7 64) on my machine, the system prompts that the make file cannot be found, but no good solution is found. If you have time, you can check the project center code, if you have projectcenter, familiarize yourself with the project organization. You can use the make command to compile the project by yourself.]

Http://www.gnustep.org/experience/PierresDevTutorial/index.html

This address describes how to create a project and interface for Project Center gorm.

After installing the program group menu, shell can start the mingw shell environment. At this time, you can use tools such as GCC g ++ make, which are familiar with Linux and so on.

Gorm projectcenter is the startup command

Shell window: You can compile projects and perform other operations.

Gorm window: Design Interface and component Layout

Project center window: Project Creation, code highlighting

Summary

Gnustep can use objective-C and cocoa. Note that the implementation of cocoa is different from that of Apple's official cocoa.

This tool implements appkit, which is not implemented for iOS's uikit.

However, as long as you are familiar with this, it is easy to develop iPhone/iPad and Mac.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.