I am trying to install MinGW but it's always failing to install - c++

I am trying to install MinGW but it's always failing to install.
on windows 7
link of the program:
https://sourceforge.net/projects/mingw/files/latest/download

Tar zips are not generally for windows users the downlink should be a windows installer mingw-get-setup.EXE thus (not a GnuZip)
Also if your trying to unpack 32bit collections the question is which architecture do you need, certainly 32.exe will run on 64, but 64.exe will NOT work on 32.
Current build is 32bit "Although (currently) offering only a 32-bit compiler suite, all of MinGW's software will execute on the 64bit Windows platforms."
get it from official https://osdn.net/projects/mingw/releases/
latest link I got was
https://osdn.net/frs/redir.php?m=liquid&f=mingw%2F68260%2Fmingw-get-0.6.3-mingw32-pre-20170905-1-bin.zip
once you have a valid windows .zip file, right click to "extract" then the exe should be in the bin folder.
Then it's just you on your own, and the myriad of instructions from google.

MinGW is a compiler generating files for the Windows platform, but MinGW itself can also be run on other platforms (like Linux for example).
What you need is are Windows binaries of MinGW.
But MinGW is a bit outdated and only supports 32-bit Windows.
I would really recommend using MinGW-w64.
Standalone build of MinGW-w64 for Windows (both 32-bit and 64-bit) are available at https://winlibs.com/ just download the archive and extract it. Then all the tools you need will be in the mingw32/bin or mingw64/bin folder.
If you're not very familiar with command line tools you should really use an IDE. There are some instructions on https://winlibs.com/ on how to use MinGW-w64 with Code::Blocks.
If on the other hand you are very familiar with command line or the Linux shell you should take a look at MSYS2 which also allows installing MinGW-w64 with it's pacman tool.

Related

What is an easy way to install a unix terminal with a C++ mingw compiler?

I'm going to teach students to use SFML with C++, and I'm afraid the school doesn't have visual studio C++ installed, or will be a bit heavy to use for those students.
I want to have a plan B and have the option of a simple makefile that I can build on windows with SFML.
https://www.sfml-dev.org/download/sfml/2.5.1/ this page offers binaries compiled with different, specific versions of mingw with their respective mingw package links, unfortunately mingw doesn't include an unix terminal, like the one included with git-bash, so I can run a makefile.
What are the steps required to have a problem unix terminal, running in windows, minsys, msys2 or not, that can work well with those mingw packages? I have trouble finding help or proper instructions.
You want https://www.msys2.org/
It provides bash terminal and already contains mingw compiler. Perhaps it even has SFML packages already.

Difference between the windows installation of minGW64 and the MSYS2 shell installed version of minGW64

I have been using the minGW64 compiler with Visual studio code on windows for some time. However, there are certain limitations to it when it comes to certain libraries. The absence of a make tool and the inability to execute a config script while compiling a c++ program being the main ones. I came to know of MSYS, a tool provides a UNIX environment that allows us to do certain things that are forbidden by the windows terminal. I installed it but I saw that I need to install mingw64 again, from within the terminal to use it with MSYS2.
My question is, is there no way I can use my earlier mingw copy with this installation of MSYS2? Is there some difference between the mingw64 that comes with MSYS2 and the standard installation?

GCC x64 on Windows

I tried installing CygWin64, but I cannot find any executables to build my code with in the C:\cygwin64 directory created.
I tried Win-Builds but the setup doesn't load with any mirror I give it. It tries to connect 3 times then aborts.
I tried MinGW-W64-Builds, but I cannot figure out how to install it. I can see a .sh file there, but I believe that is for Linux, so I do not know why because it says it is for Windows
Is there even a way to use 64-bit GCC on Windows? I am trying to tie it to a Code::Blocks IDE as that one only comes with the 32-bit version of MinGW.
Check out out the MinGW-w64 + GCC personal build at http://winlibs.com/.
No installation required, just unzip.
Examples on how to use are on the site, including on how to integrate with Code::Blocks IDE.

Can I generate exe from ubuntu

I'm using Ubuntu and I use Code::Blocks as my IDE, I'm still a student and my professor wants us to write and compile some c++ programs and give him the exes to check them
Is there a way for me to generate exe files on my Linux os ?
ps: I'm new to Linux so take it easy on me.
Thanks
You need a cross-compilation. You can use mingw tool chain, if your want 32bit Windows application, install mingw32. Here are the detailed instructions for using it with IDE CodeBlocks.
If you want to build 64-bit applications, try mingw-w64 fork.
Also, then you could run the compiled application (or, even some native windows applications, compiled on Windows) in Linux under Wine:
sudo apt-get install wine
wine myapp.exe

"Cannot execute binary file" when running compiled c++ programs with Eclipse on Ubuntu for Windows platform

I would like to move from Visual Studio on Windows platform to Eclipse on Ubuntu for c++ development, since I develop almost all my programs on Java, with Eclipse, and I just use a Windows virtual machine in order to develop C++ programs for Win OS. So if I would be happy being able to not use Windows VM at all. However, I've managed to configure MinGW and Eclipse successfully enough to compile programs, but not to execute them.
Steps I've gone through so far:
I've installed mingw32 package and dependencies:
$ sudo apt-get install mingw32
I've installed Eclipse Mars for C/C++ development (manually, to keep this installation isolated from other Eclipses I have) and created a new project in this way:
- New C++ project.
- [...]
- Cross-prefix: i586-mingw32msvc-
- Cross path: /usr/bin/
With this configuration I'm able to correctly build a .exe which I can successfully execute on Windows, but when trying to debug it or execute it under Eclipse I get this error: "cannot execute binary file".
Googleing I've seen some posts suggesting to use wine in order to execute the .exe, but I thought mingw32 would be able to execute it. Am I wrong and this is not possible or just doing something wrong?
Mingw32 is a windows compiler, and will compile source to a Windows executable file. Additionally, the compiler cannot execute files (as worded in the question), it just compiles the source code to an executable form, in this case the windows executable (*.exe). So yes, in order to run the .exe in Ubuntu you would need something like Wine which emulates a Windows environment
mingw is a set of GNU tools for building native Windows executables.
It does not execute anything.
If you really want to cross-compile for Windows, you need Windows or an emulator for the execution.
To build for Ubuntu you can just use the native compilers.
sudo apt-get install gcc