Converting a Linux C++ library to Windows - c++

I have fallen in love with the capabilities of Rheolef, a C++ library for Finite Element Analysis that is available for Linux only. I am developing an application in Windows and was wondering if I can build Rheolef for Windows and use it in my application.
I read a few posts about Cygwin but my understanding is that it only mimics the Linux environment in a Windows settings. Also, I found a technique that can compile a single source code for Windows.
Is there any tool or method that could make the entire Rheolef library for Windows from Linux?

Related

Is development for Windows under Linux using mingw-w64 as good as development under Windows?

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.

How to ship an app that uses a C++ library via CLI?

I’ve got an app that creates a child process to execute via CLI a compiled C++ library file. What is the best/most portable way of shipping my app with this library? I just need to ensure the compiled C++ code is available on the user’s system and that the executable is compatible with their system.
C++ is compiled for each platform (Windows, macOs, Linux). So you need three different distributions:
Windows - lowest common version (for example Windows 7). You also need to require or include the C++ redistributable for the compiled library.
Linux - most use gcc, so again the lowest common version. No redistributable required.
macOs is similar to Linux.
Each platform supports multiple compilers and IDEs. It’s down to personal choice.

Can i create application in Windows for Linux platform?

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...

Write C++ on Windows but use Linux System calls through a Linux emulator

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.

Writing a cross-platform program

How could I write a program which runs on both Windows 7, Mac OS X (and maybe linux too)?
I heard Qt are a great framework to build cross-platform GUIs, but I think every program version need a recompile, isn't that right? And should I compile the win version under windows, the mac version under mac os x, the linux version under linux and so on?
I'm getting ideas and/or suggestions
The underlying binary format is different on each platform, so unless you're using a virtual machine (like Java or Flash does) you will have to recompile your program on each platform.
Some compilers (like GCC) allow cross-compiling, but it is not trivial to set up. Probably the easiest system to cross-compile on is Linux (there are several open source projects that have cross compilation set up from Linux to Windows).
In case of a GUI application, it depends on the language -- if you're stuck with C++, Qt or wxWindows might be a reasonable choice providing an abstraction layer over the native windowing system.
If you can go with Java, it makes life simpler, however the windowing system is Java's and not native.
Another language to think about is FreePascal w/ Lazarus -- it has a pretty good GUI designer that compiles to the native windowing system on every platform (WinAPI on Windows, Cocoa on OSX and GTK on Linux).
Not sure if C++ is a must, but Adobe Air is a great cross platform development environment for desktop, and its growing for mobile development as well. If you need an example of a major application using Adobe Air to deploy to multiple desktop OSes, just check out tweetdeck http://www.tweetdeck.com/
I'd highly suggest also looking into Flex and Flash Builder if you go that route.
There are two separate issues I would highlight when writing cross-platform programs -- how to make your code portable, and how to arrange for it to be built on the various different platforms.
As far as the building side of things goes, I would look into a cross-platform build system like CMake (http://www.cmake.org). You essentially write a script and CMake will generate the appropriate project file/makefile for a specific platform. You then build your program on each platform as you would normally. For example, on Windows, you might use CMake to generate a Visual C++ project for you, and then use Visual C++ to actually build your executable. On Linux, you might use CMake to generate a makefile, and then build the executable using g++.
The other aspect is how to make your code portable -- the key is to write C++ standard-compliant code and make use of libraries that are themselves portable across the platforms you're interested in. You can (and may sometimes need to) write platform-specific code for each of the different platforms -- if you do, you should hide it behind a portable interface and have the rest of the code use that.
Yes, you need to compile for each version when using C++.
The only thing that prevents you from compiling a program, for example, for Windows on Mac is to get a tool for doing that. It is possible, but the problem is finding the toolset.
Also you can use a virtual machine for running diferent OSs and compiling code for all platforms on the same machine.
Java runs on Windows, OS X and Linux