We have a mathematics/scientific application for protein visualization written in C++ using OpenGL. It was written over the last couple of years and makes extensive use of C++0x features found in GCC 4.4 and later. (It also compiles with Microsoft Visual C++ 10 on Windows, which supports many C++0x features.)
We want to release an iPhone/iPad version, so we need to port it from Linux/Windows to the iPhone. We've ported similar programs with very little effort--add a handful of Objective C files, and done!--however, due to the C++0x features used here we've got a problem. Xcode on OS X uses GCC 4.2.1 (from 2007) which predates GCC's C++0x support. It seems a huge step backwards to rewrite all this beautiful C++ 0x code to not use C++0x features, and we really don't want to maintain a backported codebase when the march towards C++0x is clear.
Is there any way to use GCC 4.5 (or 4.6, from SVN) to target the iPhone and iPhone simulator? If so, how? Preferably, from within Xcode, since the click-and-run/click-and-debug functionality is very useful. It'd be great to be able to enter "GCC 4.6" in the "C/C++ Compiler Version" box in Xcode and just have everything work.
(As an aside, the top-of-the-tree version of Clang--as of just yesterday!--supports some C++0x features, but doesn't yet support lambda expressions so it's probably out for us for now.)
After you create a project, you can build and run your app on a simulated or real device without needing to lay out the user interface or write code. You may connect a real device to your Mac using a cable, or for iOS or tvOS apps, connect it over Wi-Fi after you pair it with Xcode.
You can execute any C program in XCode as long as it does not have any platform specific dependencies that would prevent it from running on an Apple device / computer.
How do I get the watch simulator to appear when I select an iPhone simulator in Device? In the Devices window under Simulators, select an iPhone 5 and later simulator. Under the Paired Watches table, click the Add button (+).
Off the top of my head, I'm going to say there probably isn't a very clean or easy way to do this, until Apple officially supports it. You probably already know this, but the reason Xcode uses an older version of GCC is that Apple makes extensive modifications to the GNU toolchain, and releases their version under the APSL (which is incompatible with the GPL) . So for the most part, you can consider their version of GCC to be a complete fork. I ran into this problem when trying to port the Apple version of the toolchain to Linux. I'd had some limited success, but it is not a small undertaking...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With