I have written an simple applications in C++, and I need to connect with any RIA just for viewing the process ... is there is any good RIA based on C++
Qt is a good, popular cross-platform GUI library for C++.
I don't know whether it matches your definition of "RIA", though.
Silverlight is the nearest framework for you. You may find this Stackoverflow question interesting.
Update
After seeing your comment, I'd recommend you using ISAPI or CGI programming in C or C++
Update 2
After figuring that you need to execute C++ code from browsers, The answer is ActiveX. But portability is an issue, rather.
Generally speaking, this is difficult to do. Clients don't trust running arbitrary C++ code from the internet, because people don't want every website under the sun to be able to install malware, and generally hijack the entire machine, every time they visit a web site. In the general case, therefore, what you want is not really possible.
If you're willing to require the user to answer a ton of prompts, and are okay restricting your application to Internet Explorer on Windows, you could familiarize yourself with COM and write an ActiveX control.
I would strongly advise against doing so, however.
Have you looked at Qt? It comes with Webkit built-in. It is also more portable than other RIA implementations. BTW, most RIA implementations run on language virtual machines that are in turn implemented in C or C++ :-)
Related
I've made a bunch of games from my own homegrown C++/DirectX 2D engine. I was thinking some of them would be more fun with the introduction of multi-player and at the very least it would be easier to distribute them and get people to play if they could run in a browser.
I'm looking to port my games into a web format and I don't think there is anything I'm doing that Flash or Silverlight can't handle. However I don't know either of those so while I could learn something new it would save time and make porting easier if I could find something in C++. Does anyone know of a preferably open source, or otherwise freely available, library I could use to give myself a leg up?
I've heard of Haxe and it seems to be similar to what I want although it introduces a new language that can be converted to C++, ActionScript, etc. I'd prefer C++ so I can reuse some code without much of a fuss.
I also found something called RakNet which may only be useful as a networking layer to my existing C++/DirectX games but less useful for a browser based games. Has anyone used this with success? How was it to implement and integrate with existing projects?
The short answer is no. C++ requires the code to be compiled into a binary executable, and for various reasons, such code is not allowed to be run in the browser.
The long answer: The native client by Chromium/Google allows you to write native C++ code and run it in the browser. However, support is very limited, in the sense that almost no browser allows it (beyond some experimental nightly builds of Chromium and such), and you're likely going to face the same issues when porting C++ code to a different OS (aka, just because it's in the browser doesn't mean it's going to run on that obscure Linux OS).
If you want to port your games to the web, you options are either re-write it for the web, or wait a few years/decades for the native client to become widespread.
Funfact: Most mobile devices allow for C++ code to be run with a minimal wrapper. It's not the web, but it's an option if your goal is to get more people playing your games.
I have read a few articles in the cross-platform tag. However, as I'm starting a fresh application (mostly a terminal/console app), I'm wondering about the easiest way to make it cross-platform (i.e. working for Linux, Mac OS X, and Windows). I have thought about the following:
adding various macro/tags in my code to build different binary executables for each operating system
use Qt platform to develop a cross-functional app (although the GUI and platform component would add more development time as I'm not familiar with Qt)
Your thoughts? Thanks in advance for your contribution!
Edit: Sounds like there are a lot of popular responses on Java and Qt. What are the tradeoffs between these two while we're at it?
Do not go the first way. You'll encounter a lot of problems that are already solved for you by numerous tools.
Qt is an excellent choice if you definitely want C++. In fact, it will speed up development even if you aren't familiar with it, as it has excellent documentation and is easy to use. The good part about it is that it isn't just a GUI framework, but also networking, XML, I/O and lots of other stuff you'll probably need.
If not necessary C++, I'd go with Java. C++ is far too low level language for most applications. Debugging memory management and corrupt stacks can be a nightmare.
To your edited question:
The obvious one: Java has garbage collection, C++ doesn't. It means no memory leaks in Java (unless you count possible bugs in JVM), no need to worry about dangling pointers and such.
Another obvious one: it is extremely easy to use platform-dependent code in C++ using #ifdefs. In Java it is a real pain. There is JNI but it isn't easy to use at all.
Java has very extensive support of exceptions. While C++ has exceptions too, Qt doesn't use them, and some things that generate exceptions in Java will leave you with corrupt memory and crashes in C++ (think buffer overflows).
"Write once, run everywhere." Recompiling C++ program for many platforms can be daunting. Java programs don't need to be recompiled.
It is open to debate, but I think Java has more extensive and well-defined library. The abstraction level is generally higher, the interfaces are cleaner. And it supports more useful things, like XML schemas and such. I can't think of a feature that is present in Qt, but absent in Java. Maybe multimedia or something, I'm not sure.
Both languages are very fast nowadays, so performance is usually not an issue, but Java can be a real memory hog. Not extremely important on modern hardware too, but still.
The least obvious one: C++ can be more portable than Java. One example is FreeBSD OS which had very poor support for Java some time ago (don't know if it is still the case). C++/Qt works perfectly there. If you plan on supporting a wide range of Unix systems, C++ may be a better choice.
Use Java. As much bashing as it gets/used to get, it's the best thing to get stuff working across any platform. Sure, you will still need to handle external OS related functions you may be using, but it's much better than using anything else.
Apart from Java, there are a few things you can run on the JVM - JRuby, Jython, Scala come to mind.
You could also write with the scripting languages directly( Ruby, Python, etc ).
C/C++ is best left for applications that demand complete memory control and high controllability.
I'd go with the QT (or some other framework) option. If you went with the first you'd find it considerably harder. After all, you have to know what to put into the various conditionally compiled sections for all the platforms you're targeting.
I would suggest using a technology designed for cross-platform application development. Here are two technologies I know of that -- as long as you read the documentation and use the features properly -- you can build the application to run on all 3 platforms:
Java
XULRunner (Mozilla's Development Platform)
Of course, there is always the web. I mostly use web applications not just for their portability, but also because they run on my Windows PC, my Ubuntu computer, and my Mac.
We mainly build web applications because the web is the future. Local applications are viewed in my organization as mostly outdated, unless there is of course some feature or technology the web doesn't yet support that holds that application back from being fully web-based.
I would also suggest Github's electron which allows to build cross platform desktop applications using NodeJs and the Google's Chromium. The only drawback for this method is that an electron application run much slower than a native C++ application due to the abstraction layers between Javascript and native C++.
If you're making a console app, you should be able to use the same source for all three platforms if you stick to the functions defined in the POSIX libraries. Setting up your build environment is the most complicated part, especially if you want to be able to build for multiple platforms out of the same source tree.
I'd say if you really want to use C++, QT is the easiest way for cross-platform application, I found myself using QT when I need an UI even though QT has a large set of library which makes pretty much everything easier in C++.
If you don't want to use QT then you need a good design and a lot of abstraction to make cross-platfform application.
However I'm using more and more Python bindinq to QT for medium size application.
If you are working on a console application and you know a bit of python, you might find Python scripting much more comfortable than C++. It keeps the time comsuming stuff away to be able to focus on your application.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I don't want to build the Thunderbird functionality. I just want to build a project with plug-in features, cross platform, and easy to install. Is there any document which point to the development of Firefox or Thunderbird?
I know the Thunderbird is build in C++, then how can i get these kind of graphics and all other function.
Please help me.
In the spirit of other answers, I feel obliged to point out that Mozilla provides the platform they used to build their applications, including Firefox and Thunderbird, -- see XULRunner.
With XULRunner you
develop interfaces in XUL (cross-platform UI description language that Firefox and Thunderbird use) or even HTML,
develop program logic in JavaScript or, if you really need to, C++ (or even Python, like Komodo does),
have support for the same extension mechanism as used Firefox/Thunderbird
Here's a partial list of applications built on top of XULRunner: XULRunner Hall of Fame.
To answer your original question, the Mozilla platform provides rich functionality on many platforms by specifying a set of cross-platform APIs (e.g. (oversimplifying) XUL for interface definitions) and implementing each API on each platform.
Implementing such a cross-platform layer from scratch is lots of work, so instead of trying to look at and copy Thunderbird's implementation, you should pick one of the cross-platform solutions mentioned in the answers here (Mozilla, Eclipse, QT, wxWidgets, etc.)
Each has its strengths and weaknesses, without knowing your current expertise and requirements it's not possible to pick one for you.
You can browse the source code of Firefox here:
http://mxr.mozilla.org/firefox/source/.
And Thunderbird:
http://mxr.mozilla.org/seamonkey/source/.
Anyway if you want to build a portable app with plug-ins I suggest you forget about trying to copy Mozilla and learn Qt or wxWidgets instead.
Eclipse RCP can be a good solution to build rich cross-platform client applications with plug-in features.
Eclipse RCP is based on Java and SWT technologies.
Here is a list of applications build with Eclipse RCP. A demo mail client build with RCP is also available here. Another great software build with RCP is RSSOwl, a feed reader.
While selecting a language/platform for development, I think the following points are to be thought of:
Development support for the features looking for.
Maintainability - in terms of the support of the platform/language, how much it is supported for maintenance.
Compatibility with the platforms of intention (cross platform etc.)
Future expandability of the language/platform
C++ is simply a great language. The rest (making use of rich graphics etc.) is to learn...
Lots of options and others have already suggested good ideas. Java will make your life (reasonably) easy but C/C++ give you more power at the expense of needing to abstract APIs.
I should add be careful - it'll likely be difficult to make changes to your app once you have committed to one set of technologies and done some serious development without re-writing. For example, if you chose C and the Apache Portable Runtime, you might have a hard time converting to something else. Likewise if you write a UI in swing, converting to SWT/Eclipse will mean a UI rewrite. I don't want to discourage you, just add a warning that I think x-platform apps require quite careful planning.
A few notes r.e. the Mozilla tree too. Thunderbird/Firefox etc essentially build from the same source tree, just using different components. The Mozilla build system is pretty complicated, in my opinion more so than the Linux Kernel. Thus, Manuel's suggestion about forgetting Mozilla is a good one unless there's something to be gained by their route.
Mozilla's category manager makes it very easy to add plugin support to your application, but like other posters said, you'll have a fair hill to climb before you get there.
Performance considerations aside, is there any known way to take existing C, C++, or Objective C code and run it directly in the browser? For example, a compiler that converts all the code into some interpreted language that can be run in the browser. Like Javascript, or Actionscript and the Flash player, or I suppose Java and the JVM.
I recognize there are higher level languages like Haxe that can be compiled to different targets. And on the other side there are projects like Cappuccino and GWT that attempt to make Javascript development more like traditional desktop development.
But I was wondering if you had an application that worked on a desktop or an existing code base done in C, C++, or Objective C could it easily be converted to a web based application?
Is there work being done on this front? Is there any practical reason to do this? Basically turn the browser into the OS?
Beside the performance issues, and the entrenchment of OS vendors, are there any technical reasons this couldn't be accomplished? Could this kind of C like code be shoehorned into a virtual machine hosted in a browser?
Google's Native Client (NaCl) uses a tweaked compiler to create x86 object code that can be verified by the browser and run in a sandbox, without a major performance hit - pretty cool stuff. They've compiled Quake under it.
This Matasano article has a good run-down on how it works.
Here is a C compiler which targets a number of other languages, including Javascript:
http://cowlark.com/clue/
Not sure what state it's in - last I spoke to the author, it handled pure C89 (subject to the limitations of the compiler frontend). AFAIK there are no plans for it ever to support a GUI.
I was wondering if you had an application that worked on a desktop or an existing code base done in C, C++, or Objective C could it easily be converted to a web based application?
That's sort of what Silverlight is for (C# rather than Objective-C, of course), since it makes the .NET runtime available. Porting a desktop app is usually as much about the GUI as it is about the language - if you have a Cocoa app and you want to port it to another environment (whether that's a browser or Windows), then you'd need more than just an Objective-C cross-compiler, you need the Application Kit and so on. WINE being a notable counter-example, it's pretty rare for these OS-specific libraries to be available at all on other platforms, let alone efficiently. And even where they are available, there are look-and-feel and usability problems when the conventions of one UI are bolted on top of another. So people tend to either use portable frameworks to start with, or else completely rewrite the presentation layer of the app.
Basically turn the browser into the OS?
There are several projects underway to turn the browser into a fully-featured environment for applications (not sure whether or not this is what you mean by "OS"). Flash and AIR, Silverlight, HTML 5. None of them plan to provide C as a programming language, as far as I'm aware.
Emscripten allows you to compile your code into javascript, which is then platform and browser independent.
I think the closest thing you are looking for is Google Native Client. It is still in early development stages though.
You may be interested in LLVM, the Low Level Virtual Machine. It would be possible to implement an LLVM inside a Java applet, Flash applet, or even in Javascript (I wouldn't be surprised if somebody hasn't already done some or all of the above).
Converting an existing application is a completely different kettle of fish, however. The paradigms of user interaction are so completely different between a "desktop" app and a "browser" app that a lot of it will have to be redesigned before a port is reasonable.
Check out Adobe Alchemy (formerly known as FlaCC), which uses LLVM to compile C/C++ to Flash.
This is possible with an ActiveX control, but this works only in microsoft internet explorer.
http://code.google.com/p/cibyl/wiki/Cibyl can make Java sources, so you could compile that for the Java plugin in a browser. Given that Java plugins are much less common nowadays though, you may be better off with a solution that compiles to Javascript.
It seems to me that the major challenges are not related to the language being used. I suspect C would be a very difficult language to implement in JavaScript, but it is possible.
It just seems like a bad idea to me.
First off, I would not write a desktop application in C, much less a web application. Second, web applications require a completely different architecture than desktop applications. Simply cross compiling a desktop application will not make it a web application. If it is portability you are looking for, I suggest using a high-level language targeting the JVM.
Maybe you should consider http://ideone.com for compiling c++ in the browser? You can also compile or interpret other languages, I personally use it rather for more exotic languages - I have c and c++ on my PC :)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I've been looking around and came across the WT toolkit, Is it stable? Any good?
I was stumped on how to go about this in C++, given the lack of libraries and resources concerning web developement. (CGI/Apache)
The purpose of my application is to populate some data from a Sybase ASE15 database running GNU/Linux & Apache Hence allow some user interactions.
I am going to use Sybase open client library (libct) to retrieve columns from the Server, feed this data back to wt model/view.
My requests:
Is there any more practical solution rather than using other scripting languages?
I mean by practical, an interface with ODBC retrieving, and MVC mechanism?
If not available in C++, any alternative in Java?
C++ isn't a very popular choice for
web applications - probably because
it's too easy to leave security holes,
and development time tends to be a lot
slower than for the scripting
languages.
Dynamically typed scripting languages convert compile-time errors to runtime errors. Detecting those might not be as easy as reading through the compiler output. Scripting languages may be OK for quick-and-dirty simple projects. Beyond a certain level of complexity one needs strongly typed, well-structured languages. Such as C++, or Java.
Most scripting languages encourage sloppy programming.
As to the "security holes": if you refer to buffer overruns, allocation/deallocation errors, the answer is "STL". And proper training of course :-)
http://www.webtoolkit.eu/wt#/
http://cppcms.sourceforge.net/wikipp/en/page/main
C++ web service framework
For starters. There are certainly more I'm sure - a healthy google search probably wouldn't hurt. Also, you could try the #C++ channel on freenode - they have an offtopic channel that you can ask about if you want to talk about non STL C++ and the people there would happily answer your questions I'm sure. Good Luck.
tntnet (http://www.tntnet.org) is great for creating web applications with C++.
Give this one a look. I never much liked Wt's design. But then, I'm kind of an anti-framework guy.
http://cppcms.sourceforge.net/wikipp/en/page/main
CGI programs are pretty damn easy to write in both C and C++ - you don't really need any special library, though having one will obviously make development a little faster. Do you really understand how CGI works? Basically, your program reads environment variables with getenv(), does some processing, and then writes some HTML out to the program's standard output.
You might want to check out klone:
http://koanlogic.com/klone/index.html
Basically, it's a framework AND server that makes writing C++ web backends easy...
The best web toolkit for C/C++ would be Apache httpd. Just write a module and you can use libct to access your database.
There is MVC modules out there like mod_spin but I don't have any experience with it.
C++ isn't a very popular choice for web applications - probably because it's too easy
to leave security holes, and development time tends to be a lot slower than for the
scripting languages. I'd say 99% of web applications don't need the speed that
C++ brings.
So this leads to a lack of good frameworks.
From my fairly light look at the area I'd say Wt is probably your best bet, although
it's more of a library of useful things (like page templates) than a framework.
I'd seriously consider not doing this in C++ though. Even Java (I prefer C++ myself) has
much stronger support for web development.
Another alternative may be the "FastCGI / CGI C++ Library" that is aimed for Boost integration at someday: http://cgi.sourceforge.net/
Qt is going to grow day by day. And Wt is the trying to stand for web tool kit based on Qt. C++ the powerful language and the best in my opinion. If you like gnu projects and independent tech. I really suggest to use them. I used PHP, Phyton, C#, VisualBasic, Fortran etc. but I did not like as much as C++ among of them.
I gave Wt a try and really liked it. I will not give you any cons or pros for using it from scratch, but when you have a backend written in C/C++ with millions of API entries then Wt is an obvious choice. There are some very powerful features that is easier to use for example dynamically loaded tables. Signal processing on the server etc.
One thing I really disliked at Wt is that it is not compatible with Apache on Windows as of time of this writing. You either have to use Unix, or IIS on Windows. Wt also offers its own http server, that is very convenient for developing your applications but I would not trust it in the role of production server as I am not sure of its security.
My personal choice for web development is Ruby on Rails, but if you have to chose between C, C++ or Java for web development, my suggestion is to use Java with JavaServer Faces
Apache Celix looks like a promising active project that meets the requirements of this (albeit old) question. See: http://celix.apache.org/
From the Apache Project description page:
Celix is an implementation of the OSGi specification adapted to C. It will follow the API as close as possible, but since the OSGi specification is written primarily for Java, there will be differences (Java is OO, C is procedural). An important aspect of the implementation is interoperability between Java and C. This interoperability is achieved by porting and implementing the Remote Services specification in Celix.