Cross platform c++ with libcurl - c++

I am a perl developer that has never went into the client side programming of things. I'd like to think that I'm a pretty good developer, except I know that my severe lack of knowledge of the way desktop programming really takes away from my credibility.
That said, I really want to get into doing some desktop applications.
I want to try to develop a simple application that will connect to my server and grab an rss feed, then display it in the console. My plan of attack is to use libcurl (and curlpp) to grab the feed (I'd also like to do more curl stuff in the future). But I want to be able to run this small program on linux, windows, and mac because I want to understand developing cross platform.
So here is the question (and I know it is extremely noobish): How do I write c++ code that will use libcurl and curlpp, and will work on the 3 major OSes? The main thing I don't understand is if I have to compile libcurl and curlpp, then how does it work when trying to take it over to the other platforms?

You need to write the code portably - basically make it a console application. You then transfer the source code (not the exe) to the other platforms and compile it there and link with the version of llibcurl on each specific platform.

Neil is right, but using a framework will make your life easier. Try QT it is very nice. It has a cross platform http API, and integrates curl.

I'd recommend Qt4 as well, I've wrote a small'ish tutorial on how to setup a windows gcc compiler on linux and compile Qt4/OpenSSL with it for windows, hope that helps.
http://www.limitlessfx.com/mingw-openssl-qt4-for-windows-on-linux.html
You can easily adapt that tutorial to compiling libcurl instead of just moving to Qt4.

Related

How can I use WebRTC in a desktop application for voice chat?

I am trying to add voice chat between peers using my software - desktop application to desktop application over a network. My software is compatible with Windows and OSX. The difficulty is that there seems to be very little documentation on using the native API, and all the tutorials I've come across are out of date.
I started off by building the libraries and linking them in a new project, but as I mentioned, the tutorials I have found on the Internet are several years out of date, so I didn't get far with that.
So instead I built the native code, following these instructions https://webrtc.org/native-code/development/, and have successfully used peerconnection_client and -_server, which work great.
My problem now is that the peerconnection_client is more complicated than what I need, and I'm finding it difficult extracting the relevant parts (I want to remove the GUI, connect to a peer programmatically, and only transmit audio). And even if I do manage to strip down the peerconnection_client code, to just make voice calls through a terminal, it would still be lot of code to then embed into my program because it isn't linked to libraries, but raw code.
Has anyone else tried using WebRTC for native desktop applications in this way before? Is there any up to date documentation for this I can use? Any help would be greatly appreciated.
Best solution is to use this project :
CEF project
You will get mac os, windows and linux implementation from one project.
You can always update your cef library's to stay on road.
You can also use Firefox variant :
Firefox implementation
There is a lot of other ways like :
QT framework.
https://www.qt.io/
I've worked on a couple Voice/Video/Screen over IP projects using native C++ API, and my advice is: don't do it unless you have tons of time on your hands. Native API/samples is very much abandonware - Google devs keep it in sync with Chrome, but you're on your own, you'll have to dig through WebRTC & Chrome issues and PRs when your code stops working after updating to a newer release branch.
The only documentation is the source code itself, there's plenty of comments, but it's still very hard to figure things out. And those things tend to change from one release to another

SDL - Cross platform development

I'm going to enter a small game competition in the coming months. They require the submission to be able to be compiled ( and it will be, before being run/evaluated for the contest) on Linux. I'm going to be using SDL and C++. I've only ever developed on Windows before and I've grown quite accustomed to the benefits Visual Studio gives. I'd like to be able to develop in windows with VS, and then near the end of the process migrate it over to linux. Beside making sure SDL is already installed on the Linux machine, are there things I can do throughout development that will make the process easier? Also, the contest rule for all of this states:
it must also work on an open platform (we strongly recommend making sure that your program run on modern flavors of GNU/Linux, as all of the judges will have access to it).
I assume compiling/running in Ubuntu (already have a home server with this) would be sufficient for this?
Your question is slightly open-ended, but my first suggestion would be to use a proper cross-platform build system such as CMake from day one. I would refrain from "migrating" to Linux at the very end; you may be under a rough schedule (and maybe run into problems you did not anticipate). Thus, a continuous build of (working) Linux versions will help ease your worries.
Furthermore, if the game is meant to run solely under Linux, why not install Ubuntu in a Virtual Machine somewhere and get acquainted with one of the development environments such as kdevelop or qtcreator? Wouldn't direct contact with the platform you are developing for make things a little easier?
I'm developing games and started like you. I'd advise you to use SFML library for this purposes. It's not very big and is very good thing to start from.
There you can use:
2D renderer (OpenGL)
Fonts
Timers
Wrappers around images/sprites
Post effects/shaders
Sound
Network
In this page you can find a few start examples.

GUI Programming C++ for Mac OS X Lion

I'm probably going to get abuse for this question but here goes. Oh but before you tear into me and tell to crawl back under a rock etc. I have looked high and low and nothing has helped me so far either the software libs are out of date and for some reason wont work on lion.
Ok other than Qt is there any other lightweight opensource GUI library for C++ on mac? I have tried this wxWidgets doesn't work for some reason. Apple don't seem to offer that carbon crap anymore or can I use openGL to create GUI's? I just want a simple nicely documented GUI lib without having to switch to windows to develop. or will I have to spend some money on one or resort to Qt.
Hope someone can help and thanks!
Why not use Cocoa (the native way to develop OSX GUIs) in the first place? You must use the Objective-C calls to create windows for example, but you can mix this code with C++ code in the same file - this is then called Objective-C++ and it is supported by clang and the gcc.
To build completely native-looking OSX Applications, you need Cocoa. Every other toolkit that can create those native GUIs calls Cocoa (at least to my knowledge).
Just as a pointer: have you tried SDL?
FLTK is simple and very stable GUI library. Runs on Windows, OS X and Linux.
Non-native look though.
Here is a screenshot of an app I built with it a few years ago, and that still runs great on Lion.
I'd take a look at both GLUT and GLUI as simple extensions to OpenGL that provide basic widgets. They can be used together to some degree, but I personally have run into a couple issues in that department. Either one in isolation is pretty simple to use if you're familiar with OpenGL though.
EDIT: Also, X11 can run in OS X, although I'm not familiar enough with the system to know how to get started with that.

Which Linux distribution should I go for learning C/C++/Assembly in Linux

I am a primary windows developer with experience in C#, .NET, Visual C/C++. I want to lean C/C++ development in linux in order to create portable GUI applications which run on both Windows and Linux.
I have used Fedora in past (2005). Want your suggestions to know which is the best distribution currently to learn programming in linux.
You can't really go wrong with any of the major ones. Personally I use Debian, but Fedora and OpenSUSE are good choices as well.
I would also like to point out that you can use C# to create portable GUI applications. Have a look at Mono and Gtk#. I have developed quite a few Gtk# apps and they usually run flawlessly on Windows and Linux, with very little work on my part. It might not be a bad introduction to coding on Linux, as you will be able to use a familiar language.
Any modern Linux distribution will do, as they all includes (or makes it easy to install) GCC. To easily create portable GUI applications, I would recommend taking a look at Qt.
Since every distro worth its salt has a Development Package that includes gcc, g++ and gdb, it's really going to come down to the IDE you develop your code in. Eclipse is an excellent IDE for C & C++ which just happens to be written in java. So long story short, use whatever distro you are comfortable with, it really doesn't matter all that much.
There is none Distribution you couldn't use. If you want an easy distribution working almost out of the box. With a lot of things configured automatically i would suggest you use ubuntu.
If you like to do more things on your own I'd tend to debian. Anyway you could simply code with qt and use the linux box for debugging only.
Slackware, ArchLinux or CentOS.
Stay away from Ubuntu and its derivatives, you will spend more time messing with packet manager apt-get than doing code. If you choose Debian-derivatives you will spend time wondering why your programs dont work only to find out you need packetname-devel also (!)
A base Slackware install should be enough to get you started, if you would like to keep having the latest programs, use ArchLinux.
You wrote "to create portable GUI applications which run on both Windows and Linux" - I suggest that you consider Qt (used to be from Trolltech now part of Nokia). http://qt.nokia.com/products/

C++ development for Linux on Windows

I am trying to setup a development environment for Linux C++ application. Because I'm limited to my laptop (vista) which provides essential office applications, I want to program and access email, word at the same time.
I'd prefer a local Windows IDE. SSH to a company linux server and using VI doesn't seem productive to me. Even using some IDE installed on the linux server doesn't seem good to me, because I can't do the work at home.
So does Eclipse CDT + MinGW work for me, or is there any other choice?
Thanks.
ZXH
Why not install a Linux virtual machine on your laptop, in VMware or similar? That way you can test while you're developing too.
You can also try http://cygwin.com/
Is it a GUI app? And do you have to target Linux specifically? If not, Qt (http://trolltech.com/) may be something that you can use. It would allow you to more or less develop your whole application on Windows, and then spend a few hours on a linux machine getting the whole thing ported...
Qt is the best choice. I develop with tis tool for a long time. And you can develop with the same ide : QtCreator and the same framework : Qt on MacOS, Linux based or Windows plateform...
Moreover, specifically on Linux, Qt is well integrated with Kdevelop !
If you have Visual Studio, which I feel is an excellent IDE, you can try to set it up to use GCC/G++. I've done this before, back in the Visual Studio 6 days. As long as you aren't using any Windows-specific libraries and write portable C++, you can compile and test on Windows, then periodically ensure that the code also compiles properly for Linux.
Another approach, one that I actually prefer, is to host your source and make files on the Linux box, share the files through Samba, then use your Windows IDE/text editor to edit those files. Then, you can do the compiling through an SSH terminal. Sure, you'd lose the convenience of being able to compile through your IDE, but at least you wouldn't have to muck around getting the compiler set up on Windows.
If you have a linux server available to you, you could also use NX to log in graphically, and use a Linux IDE there like Code::Blocks, or shudder Eclipse. Of course, there's nothing unproductive about shelling in and using VIM. I find it's a good way to shake out the IDE-induced cobwebs every now and again. Happy coding however you end up doing so!
I use (and recommend) Netbeans for C/C++ Development together with Cygwin to develop POSIX applications on Windows that will run on Linux/Solaris later on.
It is pretty easy to setup as long as you stick to the stable version of Cygwin.
I was in a similar position 2-3 years ago and tried several approaches, but the only one that really worked wor me was vim+ssh (+gdb, make, svn, etc). But again, I use vim even for Windows development.
This slideshow (PDF) walks through how to set up a cross compiler from Windows to Linux.