¿Cómo ejecutar aplicaciones C ++ en una página web?

Are there any tools to run C++ applications written in QT on standard web browsers?

My C++ app has to run from a webpage, do some math, and return the result back to the webpage.

preguntado el 27 de agosto de 11 a las 16:08

Do you want to embed the C++ code inside JavaScript (using a C++-to-JavaScript compiler like Emscripten), or do you want to use a browser plugin instead? -

6 Respuestas

Más info: NaCl (Native Client). No Qt, but you can use c++.

Respondido 27 ago 11, 20:08

There's actually this: labs.qt.nokia.com/2010/06/25/… but I don't know how mature it is. - SSJ_GZ

Interesting links (+1). Is it really usable? - Jiri Kriz

While chrome does have this functionality and an advanced programmer could benefit from it ... I don't know that this answer helps the OP. - Brian Roach

Thank you, I don’t know about NaCl. But now NaCl is only for Google Chrome web browser, it lack of community and it still beta. - lexl

You can't. You can write the server side in a web app in C++, of course, but the Qt GUI framework is only for applications that show their user interface on the machine they are running on. (With the usual caveats in the case of remote X11 connections and so forth, but that won't help you for a web app).

Respondido 27 ago 11, 20:08

Is it possible to do math in C++ app and visualization part show in web browser through JavaFX or something like that? - lexl

You can certainly do computations in C++ on the server side and display the results through a web interface. You can even use the non-GUI parts of Qt to structure your C++ application of you wish to, but you cannot use the Qt GUI for the user interaction. It's not quite clear to me what JavaFX would buy you; an ordinary JavaScript-based client-side UI (where you generate graphs and such on the server and transfer them as PNGs) would be just as straightforward. - hmakholm dejó a Monica

In my case it is important to place computational code written in C++ on client side and it application must behave like smart client i. e.: delivers applications over a web http connection does not require installation (or provide automated installation) automatically updates without user action has the look and feel of desktop applications Now there are several platforms to build such apps: Adobe Flash, JavaFX, and Silverlight. JavaFX is only suitable one for my purpose but I don’t know is it possible to bundle it with C++ computational code. - lexl

I don't think those objectives are achievable simultaneously. Even "look and feel of desktop apps" and "no installation" sounds like a mutually exclusive pair. Combine that with a requirement to use a language as far removed from the "mobile code" ecosystem as C++, and you certainly have your work cut out for you. - hmakholm dejó a Monica

You could run Qt in NaCL yes? - Rogerdpack

I have read about a sample application like this. I think you can search for this term "Qt WebKit Hybrid application". In that example, the user interface is written in HTML and Javascript and the backend in C++. Even, the C++ objects ownerships can be transferred to Javascript. I'm not sure I'm correct but I'm partially correct.

EDIT: Here is the link. https://developer.qt.nokia.com/wiki/Server-Driven_UI_with_Hybrid_QtWebkit

Respondido 28 ago 11, 15:08

Thank you for your answer. Usage of the Qt WebKit is quite inverse solution because it allow web content to be integrated with C++ and executed over the Qt framework. But I wanted to execute C++ code over the web page. Qt WebKit is not what I expected but I rest my gaze on this tool as a compromise. - lexl

It's possible to compile C++ code to JavaScript using Emscripten, and then call compiled C++ functions from JavaScript, como se explica aquí. This will allow you to run C++ code in a web browser or other JavaScript environment, without any additional plugins.

Respondido 15 Feb 13, 22:02

There is one more solution to this, you can write a browser plugin. I think that this is better then ActiveX and NaCl. For details on how to write plugins check this: ¿Cómo escribir un complemento C ++ FireFox 3 (no una extensión) en Windows?

contestado el 23 de mayo de 17 a las 14:05

Maybe you could embed the code in an ActiveX control.

Respondido 27 ago 11, 20:08

ActiveX is not a cross-platform tool. It's sensitive in my case. - lexl

After reading all the other comments it seems that you want a corss platform and cross browser solution. So the only option is to translate the C++ code to Javascript. If your code does just some math it should be possible to translate it to Javascript. - Andrei Bozantan

Problem is that my application sensitive to execution time. It is a real time video processor with a lot of math and it widely uses the third party C++ libs. It is impossible to transfer my app to the Javascript framework to do that math. But thank you anymore. - lexl

I just got the same idea, to have a QT presentation layer which can be rendered/used in a browser cross-platform. ActiveX would actually run as native, embedded in a web browser frame. - Ivan Marinov

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.