How to run Xcode C++ on iOS sumulator - c++

How do I run C++ code, developed in Xcode, on the iOS simulator on a Macbook Pro?? Is C++ compatible with the iOS simulator? The command line has c++ but there is no option for iOS simulator on it.

You can mix Objective-C code and C++ by using Objective-C++. All you need to do to start using Objective-C++ is to start with an Objective-C project, then rename a source file to have the extension .mm instead of .m. Objective-C++ files can then include plain C++ headers directly, and you can compile plain C++ sources as part of the same Xcode project.
Here's a tutorial with more details.

The simulator can run iOS apps, it can't run terminal applications that won't run directly on an iOS device.

You can run C++ code in Xcode, but it'd be running on your Mac, not the iOS Simulator. Xcode when building for iOS (and therefore the simulator as well) only natively support Swift and Objective-C.

Related

Using XCode and CodeBlocks on the same C++ SDL2 project

I've just received a MacBook Pro for cross-platform game development. I've been making an SDL2 game project on CodeBlocks for Windows and Linux, and everything's fine on both operating systems so far. However, when it comes to Mac OS X, it seems I've got to use XCode instead.
I could figure out how to create a working SDL project in XCode. However, I would like to create an XCode project that shares the same source code as my CodeBlocks project, which happens to be on a Git repository. I've yet to find out how to do that. However, I've already put the #ifdef platform preprocessor instructions in my source code.
Could you give me some tips for doing that?
Use CMake to generate platform-specific makefiles/IDE projects.

iOS problems using c++ code which invoke epoll()

I knew that iOS apps could use shared C++ library. However, now I have some C++ code that uses epoll() function, and iOS is based on a BSD kernel that doesn't have epoll() function, so when I integrate these C++ code to my iOS xcode project, there are some compile error, such as "sys/epoll.h file not found" and so on.
How could I do now? Thanks for any help!

Compiling/Running C++ code on iPhone without convert to Objective C

I wrote my project on Visual studio 2010 and I used on it tesseract ocr library , Opencv and Cvblob , and now want change it to from desktop application to mobile application on iPhone so can I compiling and running it without convert to Objective C ?!
Well, you can compile and run straight C or C++ on iOS. You can even inline it in Objective-C classes.
But you will still need Xcode (and thus a Mac) to build and deploy, and you will not be able to just use code you built against Windows frameworks.
It seems tesseract does not currently support iOS, so if you require that and can't port it yourself, you probably can't just port your app to iOS without rewriting major parts of it. But that isn't just a question of programming languages.

C++ app for IPAD with C++Lucene library

I am planning to build an app in C++ for ipad. I have never build any app for ios. I want to know whether is it possible to write a C++ app using Lucene library in ipad. Can i write the code in visual c++ and compile it in xcode. Can i use the same code to work in mac os as well? I really wanted to build the app in Java so it works every where but unfortunately I pad doesnt support java.
Please provide me some good suggestions to build this app.
Thank you.
No. You can't build for iPad in Visual Studio.
You can include C++ in "Objective-C++" files, named .mm, but you will have to learn a minimum of Objective-C in which to include your C++ code.
As for using the same code for mac, it depends on how well you separate your logic from your display code - you can reuse some code, but you can't simply hit "build for Mac" and have iPad apps magically run on the Mac. You'll have to, at the very least, build a totally separate interface.
Building apps for iOS, etc requires some simple steps :
Buy a Mac
Learn some Objective-C
There is no other way around that makes sense.

Cross-platform C++ IDE that also supports Objective-C?

I have a few projects where most of the code is written in platform-agnostic C++, with a relatively thin platform abstraction layer for each supported platform. For most platforms this abstraction layer is also written in C++, but for iOS and OSX it also contains some Objective-C code. For this reason, I have Xcode projects for the iOS / OSX builds, and Visual Studio projects for Windows, but I'm a bit tired of having to maintain multiple project files.
It would be so nice to only have one cross-platform IDE, one project file for that IDE, then just add all source files to that, and make some of them included in the build only in certain configurations. But for that I'd need an IDE that runs on multiple platforms (Windows, OSX, preferably linux too), and supports not only C++, but Objective-C source files as well. Is there such a thing?
You can try QtCreator. It's a cross-platform IDE developed for Qt but it supports Objective-c too:
http://qt-project.org/downloads