Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8670963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:49:52+00:00 2026-06-12T18:49:52+00:00

I am trying to develop a C++ library for an iOS application. This library

  • 0

I am trying to develop a C++ library for an iOS application. This library loads the GLES and OpenAL functions.
The idea is to develop a library in C++ and use the same code in iOS and Android (both as native compilation).
I am only with the iOS implementation, and I have done a sample application with the library and I have this block inside the library:

#ifdef _IPHONE_4_0

    #warning "Including iPhone SDK 4.0 working here"     // compiling warning is actived

    #include    <OpenGLES/ES2/gl.h>
    #include    <OpenGLES/ES2/glext.h>

    #include    <OpenAL/al.h>
    #include    <OpenAL/alc.h>

    ...

#elif __ANDROID_API_ // Android

    #warning "Including Android working here"   // Compiling warning is not actived
        ...

#endif

So, the problem comes with the sentence “#ifdef _IPHONE_4_0”. If I use it, Xcode can’t find the include files, but if I comment all the if clausule (android part too) Xcode can find all of them.

#warning sentences shows that the compiler is reading the iphone part (with and without lines commented) in compilation time.
Do I need to use the definition in other way?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T18:49:54+00:00Added an answer on June 12, 2026 at 6:49 pm

    Check this post How to detect reliably Mac OS X, iOS, Linux, Windows in C preprocessor?

    Also, as I know, __IPHONE_4_0 macro defined only in iOS 4.0 SDK. So the code should not work if you are using another version of SDK.

    Another approach is define your own macro in Xcode project build settings (‘Preprocessors macros’ field) and name it IOS_BUILD, for example. It will be available in both – objective-c and c++ code

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use c/cpp functions/library in an Android application using jni. any suggestion
Im trying to use ZXing library to develop a Java project for decoding a
I am trying to develop a BLE bluetooth (SMART) application for Android. I managed
I've been trying to develop a C++/CLI library for use in C# and I
I am trying to develop an application for my localhost on which I can
I am trying to develop an application to forward received SMS to a web
I'm trying to develop an external library (not sure if that's the right term)
I'm trying to develop a custom PDF viewer using PDFLibNet library. I downloaded compiled
Im trying to develop an application in php to download pics from picasa using
I 'm trying to develop an Image Processing application for the images stored at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.