Xcode Non-terminal C++ project - c++

I am an amateur mac user and I'm trying to make a c++ project in Xcode. Everywhere I go I am told to make a Command Line tool project in Xcode.
This is frustrating because I intend to make an OpenGL app and so I don't want it to be a console app.
This may be a very amateur question but I'm not familiar with Mac's. How can I make a non-console (terminal), C++ app in Xcode that I can make my OpenGL application in?
EDIT: Could I use SDL for windowing rather than cocoa?

You'll have to make a Cocoa application, and change the extensions of your files from .m to .mm. This tells the compiler you will also be using C++ with Objective-C.
The way Mac handles windowing pretty much requires the use of Objective-C, so you need the base Cocoa to make the window and the GL view, and then you will be able to write the rest in C++ as you would normally.
If you really want to be entirely C++, you could use a framework like GLUT that handles windowing itself.

On this case you probably do want a command line project.
The Xcode templates are to include a Cocoa nib if you are doing all the GUI with call to another library the it is a pure C++ project and no need for these templates.
You might need to do more if you are making it appear to be an OSX app that is an .app bundle that can be run directly from Finder or dock. In this case choose a Cocoa application and remove main.m (replacing by a main.cc) and the nibs.

You can make a Cocoa application and set up the OpenGL context using the native APIs, and then integrate your C++ code into that, or you can create a command line application that uses the GLUT library to set up OpenGL. Those are the two main ways.
Note: OpenGL 3+ isn't supported by GLUT on OS X yet, I don't think.

Related

Qt Creator - SFML Link to a console project

I am currently working on a project in console mode in which I wish to implement a sound. Our choice then turned to SFML, we get to install and use on OS X. However, we need to make it compatible with Qt project for rendering, I generate a.Profile and integrate our code and the library.
In OS X, no problem, installation and use possible. However, for this project, we need to integrate it into the code to make only archive. But every attempt to link our project with the aforementioned library, we run into errors.
Could you tell us exactly what files are to be included in the project? Working on protecting machines, we cannot install packages. Here is the screen of the integration window, the button exhilarating. We cannot select the Library.
You just have to use the external library instead of the internal.

Use C++ within iOS project

I'm looking for a solution to create an iOS project with C++.
Do you know if there is other manners than mix C++ with Objective-C ?
It's for a game written in C++, using some librairies : OpenGL, SDL, ...
Do you know if it's possible to use these librairies with an iOS project ?
I found something like this kind of stuff :
http://philjordan.eu/article/mixing-objective-c-c++-and-objective-c++
On this website you'll see in a video how to port your SDL game to iOS.
This link might be useful too; a step by step tutorial on how to use SDL.
This is basically it:
Create a new iPhone view based application project.
Build the SDL libraries statically (libSDL.a and libSDLSimulator.a) for iOS and include them in your project. XCode will ignore the library that is not currently of the correct architecture, hence your app will work both on iPhone and in the iPhone Simulator.
Include the SDL header files in your project. (e.g. #include "SDL.h")
Remove AppDelegate.h and AppDelegate.m -- SDL for iPhone provides its own UIApplicationDelegate. Remove your storyboard -- SDL for iPhone produces its user interface programmatically.
Delete the contents of main.m and program your app as a regular SDL program instead. You may replace main.m with your own main.c, but you must tell XCode not to use the project prefix file, as it includes Objective-C code.

To what extent can I make my C++/OpenGL project work on both iPad and PC?

I'm developing a little game on Linux at the moment but I'd like to try making an iPad app out of it.
I've been looking over tutorials and it seems like I'll be able to make the my core C++ code compile on XCode without modification (it has no dependencies outside the standard library), and if I use OpenGL with SDL for the UI then the bulk of that code should be portable as well.
I assume that a certain amount of code will have to be different between the build processes, obviously I'd like to minimise that. I've never done any XCode development before, so can someone please advise on the following:
Will I be able to make the XCode project point to the core library source tree and compile it without dicking around with it, inserting project files etc? In other words, can I keep all XCode-specific files somewhere completely different? I use CMake on Linux and like would like to keep the out-of-tree build approach.
What at the SDL layer will have to be done differently for the iOS build? In other words, if I have a slave libgraphics library which is SDL and can paint the core state into a context provided by its master application, how do I create this context differently on iOS as compared to Linux?
At the moment I know nothing about the particulars of window creation and user input on iOS, or any Apple product caveats (e.g. how do I respond to the iPad going to sleep). I'd appreciate any pointers about all of this but the real question here is how do I structure the project so as to be maximally cross-platform?

Use Qt for iOS without GUI (still use native Cocoa Touch)?

I have a server written in Qt (primarily because I need to use the Qt encryption package) and I want to port it to iOS. I've checked out the Qt4iOS project, and I am able to compile my server into a .a library. However, I still want to use the native Cocoa Touch (Obj-C) interface of the app. I just want to be able to start the server from the app and use it.
I'm not terribly sure how to do that... Should I just call the qt_main function (converted from the main function by Qt4iOS) within my ViewController? Qt4iOS has instruction for apps that are completely Qt. You link the .a file and remove everything else and it will work. But what if I don't use Qt GUI?
Many thanks!

simple GUI addon to existing win console app

I've always been developing simple(console) apps. And even then most problems I had was with starting/porting/CMaking/ libraries to work.
I need to find a gui which is added/used by adding #include "somelibrary.h" to EXISTING c++ project. I've downloaded QT, but it seems I have to create a new QTproject,... and thought alone of including all CUDA,OpenCV,others is making me sick.
I've been experimenting with windows forms (.net?) but there is this managed/unmanaged border with its creepy bugs.
So I'd like to add GUI to existing project (where forms can be designed in completely separate designer).
Do you know any?
Or maybe You'd suggest me different approach?
I suggest you to use CMake and Qt. CMake is better than qmake to manage projects and use additional libraries. Currently Qt is the best multi-platform GUI API.
QT and winforms can be added on to an existing project but it's harder that taking a gui application and adding your project to it. Event driven code is organized differently than procedural code.
You don't need CUDA or OpenCV for a GUI.