I want to develop cross-platform programs using C++. I found out that I can easily develop programs for Linux under Windows using remote development in Visual Studio using e.g. WSL. When I searched how to develop programs for Windows under Linux, I found that I can use mingw-w64 to do it. My question is whether the development using mingw-w64 is as good as the development of Windows programs under Windows. What do I mean by "as good as":
absence of errors
no limitation of using libraries
no problems with debugging
etc.
In short, I want the development and most importantly the resulting programs to be the same as in development under Windows.
Globally, I want to choose my main OS for programming: Linux or Windows. I prefer Linux but am afraid that it will somehow limit my ability to program cross-platform solutions. Currently, I'm programming only in Python and didn't have any problems but I'm learning C++ and I want to use it professionally later in life.
UPD: Also, can I use remote development for Windows under Linux? I would be glad to see some articles, videos, tutorials. Because if I search it, Google outputs the results for development for Linux under Windows - it doesn't understand that I need it to be vice versa.
The situation is this:
I do not have access to a machine running on Linux, just a little embedded platform where I cannot install any IDE (which is in LINUX and is my target), so I got to develop the app from my Microsoft PC.
The question is: should I use Microsoft libraries? Because I am developing in a Microsoft environment, or should I use Linux libraries? Because my target is Linux?
Applications targeting Windows do not work out-of-the-box in a Linux system (see some discussion here https://superuser.com/a/209736).
You could, however, use a Linux guest from the Windows host, through a virtual machine or even docker.
Also, your "little chip target on which you cannot install an IDE" sounds like an embedded platform. Make sure the architecture on the target is the same as your windows pc x86-64 (intel). Many embedded platforms have a different architecture (e.g., ARM's aarch64). In this case, make sure to use an appropriate cross-compiler that will create code for the target.
I have around of 4 years experience in C#.Net programming and i am developing a client server application. The server application will be insalled on CentOS and client application will be installed in Windows OS. But, i don't have much knowledge about c++ programming on linux platform. So, my question is that can i create a console application in Windows OS and compile it for linux platform. it is not necessary that compile it on Windows. but, it should be executed in linux platform. I am new in linux programming.
Presently i am using TC++ editor. Can i use Visual Studio 2010 to build server application for linux platform?
if there are another approach then please suggest me.
Thanks.
You can develop the client in C# and the server in C++, if you prefer. Consider that unlike C#, there is no standard socket library yet, and you'll have to rely on either system calls or their higher level wrappers (like boost).
I've to tell you that Windows uses BSD sockets (its own version, with some modifications though), therefore with a few preprocessors checks, you can make your application portable.
In your case, I'd suggest you to go for boost.asio which will hide all low-level stuff for you. It's even cross-platform.
Maybe you can use VS as an editor ; Make sure that you do not include any windows specific libs; There is an option of using cygwin and doing a cross compilation. Check the links
How to cross compile from windows g++ cygwin to get linux executable file
I guess it will be more of a pain. Better use Virtual Box --> linuxMint/Ubuntu + Eclipse with C++ plugin or some other C++ editor...
I would like to develop C++ on Windows because I prefer the Visual Studio IDE (eclipse on Linux isn't very nice). However, eventually I will migrate to Linux and some of the code I will be writing will use low-level OS system calls.
Is there any way I can install a Linux emulator (not sure what you call it) on Windows, write Linux system calls in Visual Studio 2012 and have these system calls target the emulator, rather than the Windows OS?
I have tagged VS2010 but I can use VS2012 also.
Windows OS is Win 7.
You've already tagged your question with Cygwin. That seems like the best solution for what you want. Cygwin is basically a collection of programs which emulate a GNU/LInux environment through the use of a
DLL (cygwin1.dll) which acts as a Linux API layer providing
substantial Linux API functionality.
Here's the link to the documentation for its API
Edit: Most of the Cygwin source code that I've looked at is written in C++ and makes system calls using MS Windows API to do provide the *nix emulation. The source is well written and very readable (even to to a non-C++ programmer such as myself). I think using Cygwin would be a good transition from programming on Windows to a GNU/Linux environment.
I'm taking an Introduction to C++ this semester, so I need to set up development environments in both my Windows and Ubuntu partitions (I switch between them). I was planning to use GCC in both environments for consistency and because I plan to do my serious C++ developing in Linux with GCC.
It appears that installing MSYS and MinGW is the best way to use GCC and replicate my Linux dev environment. However, just setting up MSYS and MinGW in Windows appears to be a long and arduous process, and I'm imagining that I will have limitations or compatibility problems in the future.
Do the benefits of setting up a MSYS Linux-like development environment on Windows outweigh the costs?
Will I be able to use all the libraries that I could if I were using Visual C++?
I think you're going about this the wrong way - I would actually suggest you use Visual Studio on the Windows environment, rather than going out of your way to setup GCC. It's a benefit, not a drawback, to run your code on multiple compilers from multiple vendors.
Both GCC and Visual Studio are highly conformant (at least recent versions). You won't have any trouble with standard libraries and going between them, and if you do have trouble, it's probably an issue in your code.
I've always installed cygwin on Windows. To me, Windows is completely unusable without it. I've never really run into problems with DLLs mentioned above. However, I've also rarely used the GCC compiler, so I don't know how it compares to Visual Studio for general programming. For anything with a Windows GUI or Dot Net based, I would definitely stick with Visual Studio.
If you stick with the automated installer, MinGW installation is not painful at all. Unfortunately, that currently gives you GCC 3.4.5, rather than the newer 4.4.0 release that they also provide sans installer.
In reality, for course work, 3.4.5 will be just fine, I imagine.
Use gcc on Ubuntu and Visual Studio on Windows to get exposure to both. This is an intro course so Windows, Linux, Visual Studio, gcc are just the tools you need to master C++ and data structures. Mastering the tools will come over time and they will change.
I personally develop for windows using a pure Linux environment using mingw-gcc on Linux to cross-compile for windows.
I put a tutorial on how to set it up for OpenSSL/Qt4 # http://www.limitlessfx.com
Do you do this to get .exes or just to be able to work on both OSes?
If you feel more comfortable with GCC than VC, setting up Mingw/Cygwin is possible but doesn't give you any new functionality (beside .exes). Instead, I suggest you turn one of your partitions into a virtual machine - this way you can have both OSes open at once! (My personal choice is Windows inside Linux, YMMV.)
The benefit of developing on Linux is ready availability of tons of development tools and libraries. Also, big builds are noticably faster.
Since you said "I plan to do my serious C++ developing in Linux with GCC", VC++ may not be what you really want. Many libraries just don't compile well in VC++. Try some yourself. Instead, consider running Linux on Windows. There are several ways to do this:
Use PuTTY to connect to a Linux machine, and use Xming to see the UI windows. I would only do this over a LAN.
Consider coLinux. You can run Linux under Windows and just shut-off Linux when you are done.
Consider other virtualization options like VMWare to run Linux. Pretty much the same as coLinux, but it might be easier to setup.
You may even want to install Linux directly on your machine. You can always use tools like Wine or VMWare to run Windows if you need it.