Raph Schim
Raph Schim

Reputation: 538

Web App and c++

It's something totally new for me, and since it seems to be something trivial, I can't find any response with our beloved friend ggle... My question is : I have to create a webapp that can work if the client have nothing on his computer but a browser. My question is : is it possible to include to my project an external library (here I want to use PCL (Point Cloud library), a C++ library), and make it works even if the client have nothing installed? If I use QtWebKit for example, will I be able to create this kind of webapp?

Thanks a lot, and sorry for the (maybe) stupid question, I never did web dev before, it's my first time. ...

Have a nice day!

Upvotes: 1

Views: 813

Answers (1)

Matt Innes
Matt Innes

Reputation: 2191

Wow, that question is as broad as the day is long, but here goes (you don't give too much about your background so I apologise if I am going too basic).

A web browser is just a piece of software that knows how to process HTML, CSS and Javascript passed over HTTP from a TCP socket.

So, on a most basic level, to get something to work in a browser all you need is to write a program that listens on a TCP socket and passes headers and HTML in the body of the response as per the HTTP protocol.

So, leaving aside the socket part, your method may look something like this:

std::cout << "<h1>Hello, world!</h1>" << std::endl;

In fact, the vast majority of the original dynamic web sites worked just like this: they were just C programs that just happened to produce HTML as output in the old days (cgi-bin).

The main issue with this approach is it's very tedious and time consuming to write code to that level of detail to generate HTML, especially when you factor in CSS and JavaScript.

This is one of the key reasons that most web applications these days are implemented in Java, .Net, Ruby, PHP etc as there is a wealth of fully-featured, stable and mature frameworks for web development that take the grunt work out of creating dynamic web sites (and C/C++ is much rarer).

However there are a couple of good frameworks out there for C++ if that is definitely the language you want to use.

Wikipedia has a limited section on C++ frameworks but it covers the 2 I would suggest investigating (CppCMS and Wt): https://en.wikipedia.org/wiki/Comparison_of_web_frameworks#C.2B.2B

Of these, I've only had direct experience of CppCMS but I can recommend it - it's approach is idiomatic C++ (to my eyes at least, but I must confess I am more often a Java web developer than C++)

Also, there is quite a useful if slightly dogmatic SO discussion on this thread that may be relevant: How popular is C++ for making websites/web applications?

Upvotes: 1

Related Questions