I'm been learning C++ for a few weeks now and have been programming very small apps that I have successfully managed to run in a flavour of Windows. I now have a requirement to develop a small app that is to be run in Linux and I'm just wondering if this app can still be developed in Visual Studio Express 2010? Similarly, if I can use this, do I have to do anything differently?
Regards and best wishes for 2011 fellow C++'ers :)
You can write your code/such in VC++, but when you want to actually compile it for Linux, you'd have to find something that can run/compile it on Linux (unless you somehow found a way to get Linux to run VC++ XP)
Thanks firedraco. So just to confirm, the code would be the same however I may have to vary the libraries I use too and then once the code is complete, I can then compile it in Linux?
If you're using the Standard C++ library, then you should be fine. If you start using platform-specific libraries (threading for example, is platform dependent), then you will have to use the POSIX thread library for Linux.
I highly suggest just developing in Linux. This way you don't have to worry about conversion of code. A very popular IDE for C/C++ linux is Eclipse.
I do all my GUI in the wxWidgets way (standard c++ & including their headers). Thus my code for Windows and Linux is identical. However, doing multithreading is different on windows and Linux (Linux is much easier), so you will have to use occasionally #ifdef WIN32 and the like.
Another solution is to make a wrapper base class for all your windows/buttons, etc., and put some nasty #ifdefs inside them, in which you call directly the underlying WINAPI/linux GUI functions. This is in fact the best solution in the long run, but in the short run it is much more work.