Introduction to options in Xcode cross-Development Programming

Source: Internet
Author: User

DiscussionXcodeIn cross-development programming, the options are described in this article.XcodeIn cross-programming, let's look at the content first.

Select the OS SDK for development

To select the SDK in makefile, you must add the appropriate option to the compilation and connection commands of the project, that is, add the-isysroot option to the compiler, and add the-syslibroot option to the connector. If you use GCC 4.0 for compilation and connection, you should add both options to the command line at the same time.

-The isysroot and-syslibroot options both require specifying the full path of the SDK directory you want to use. The best practice is to create a makefile directory variable to specify this path. The following example shows how to assign a value to the makefile variable in a simple C program:

 
 
  1. SDK=/Developer/SDKs/MacOSX10.4.0.sdk  
  2. CFLAGS= -isysroot ${SDK}  
  3. LDFLAGS= -isysroot ${SDK} -Wl,-syslibroot,${SDK} 

NOTE: If your makefile directly passes the LDFLAGS option to ld instead of gcc, you should specify the connector option as LDFLAGS =-syslibroot $ {SDK }, because ld does not support the-Wl syntax.

The SDK directory is located in the/Developer/SDKs path. Your own connector switch should naturally include other compiler and connector options required by the program.

Important: GCC 4.0 supports the-isysroot switch, but it is not described on the compiler man page, because this function may change in the future. If this function is formally added to the compiler, corresponding update information will be added to the man page. Earlier GCC versions do not support this switch.

Select OS Deployment

You must use another makefile variable to set the deployment target in makefile. The format is as follows:

 
 
  1. ENVP= MACOSX_DEPLOYMENT_TARGET=10.3 

The value of the MACOSX_DEPLOYMENT_TARGET option determines the earliest target system version that your software needs to support. In the previous example, the target system is 10.3. In makefile, include this variable before your compilation and connection commands. For example, a simple C program may use the following concatenation command:

 
 
  1. testapp: main.o  
  2. ${ENVP} ${CC} ${LDFLAGS} -o testapp main.o  
  3. main.o:  
  4. ${ENVP} ${CC} ${CFLAGS} -c main.c -o main.o 

Summary: IntroductionXcodeThe option content in cross-development programming is introduced. I hope this article will help you in your learning process!

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.