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

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!

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.

Can there be a C++ GUI Static library? But not a .dll?

Yeah, I am wondering is there anything like that? Normally a static lib will be Console based, but what I need is a GUI library for suppose a HelloWorld MessageBox when I call helloworld() func in a console application.
Straight to the point, I need to integrate one GUI library (may be plugin - if plugin its a .dll right? OK anyway) in a Console Application.
I've tried looking at Qt4 Plugin creation but I think its only for Qt based applications? Please provide any links for my requirement. Thanks ...
You'll have to compile your GUI libraries into a static library. That doesn't have anything at all to do with console or non-console applications.
Then, if you link your application with that, you get what you desire. But don't be surprised about the file size of your resulting program.

Xcode Non-terminal C++ project

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.

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.

What is an App Bundle on Mac?

I have a basic C++ applicatin build using g++ and -framework ...
when I run it, I get a :
Working in unbundled mode. You should build a .app wrapper for your Mac OS X applications.
(which is not std::couted by any of my application).
What causes this, and how can I get rid of it?
Thanks!
You need to create a folder structure and place the binary in a special location. For an example with explanation see this Qt page
Mac OS X handles most applications as "bundles". A bundle is a directory structure that groups related files together. Bundles are used for GUI applications, frameworks, and installer packages. These are presented to the user as one file in the Finder. When set up correctly, bundles make for easy deployment. All one needs to do is to archive the application using some preferred method. Users then open the archive and drag the application to wherever they please and are ready to go.
There is something written about this for wxWidgets too
MacOSX introduces a new way of putting together an application. Instead of adding a resource fork to the executable file, you can simply create a special directory (folder). This is the preferred method for OSX.