1

I use the Dev-Cpp program with the MinGW compiler that allows you to compile C / C ++ code to obtain a Windows launcher, but is there a compiler for Windows that allows you to create executables for Linux?

1
  • The term you're looking for is Cross Compiler. Commented Feb 28, 2020 at 17:24

2 Answers 2

2

You can install Windows Subsystem for Linux, or set up a VM and do it that way.

Or as @user4581301 mentioned, use a cross-compiler.

http://metamod-p.sourceforge.net/cross-compiling.on.windows.for.linux.html

Sign up to request clarification or add additional context in comments.

Comments

1

Ignoring the fact that Dev-C++ has been obsolete for nearly a decade (I may have an unpopular opinion however that you should use whatever tools you can to learn whatever you can, even if that means using 'obsolete software' [as long as it's purely for learning and not production use])...

You have a couple options, one of which has been mentioned by somebody. 1.) Use a cross-compiler, and 2.) (which I personally would recommend, if it is viable for your particular needs) simply compile on actual Linux.

To do this, you just need a working distribution of Linux with a development environment. You can use a virtual machine, Windows Subsystem for Linux (WSL), or a physical machine with Linux running on it.

From there, if you want the code to compile for multiple operating systems, you'll have to make sure your libraries and frameworks and other OS-specific code (e.g., filesystem paths, system calls) are properly handled, or just use cross-platform libraries. If you're dealing with standard C/C++, then this won't be of any concern.

Since Dev-C++ uses MinGW (the Windows port of GCC), then the actual compilation process should be the same, although on Linux IDEs are not commonly used, so you may have to get your hands dirty with shell commands, but that's not too hard once you get started. Good luck!

2 Comments

Can you recommend a cross-compiler and explain how to use it (if possible I would like to use it via terminal)? The reason for my request is that I want to create a sort of cross-platform IDE (open-source, even if it already exists)
Looks like h4le5torm has provided an excellent starting point for this. If what you are doing is open source, then I would say just use a cross-platform GUI toolkit (e.g., wxWidgets, qt5, fox-toolkit, FLTK, etc...) and provide the source to Linuxians. They are usually very happy to build from source themselves.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.