How to compile a Linux program with Mingw? [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a Linux program that I want to run on Windows. I want to compile it for Windows using Mingw?
I am new to this Mingw thingy. So, I have no idea if it will work.
I installed Mingw and I have a make file. What's next? I have a bunch of exe files in Mingw. I don't even know how to start the compiler.
So, my question is: What are the steps necessary to compile the program I have?
UPDATE:
I figured out in the end what are the steps necessary to compile a Linux program for Win using Mingw.
I posted the solution below (solution is 7 steps), maybe it will be useful to others also.

To compile a Linux program on Win:
Install MingW
Edit the c:\MinGW\msys\1.0\etc\fstab file (it should contain this line: c:/mingw /mingw )
Start Wingw shell by running c:\MinGW\msys\1.0\msys.bat
In shell go to the folder where your Make file is (use cd command for this).
Type 'make'. This will compile your program.
Put the generated EXE and the required DLLs (libgcc_s_dw2-1.dll and libstdc++-6.dll) in the same folder
Run the exe file and enjoy it....

Related

How to run gui based programs on macbook by terminal [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I am on mac os and have terminal in it. I run simple c++ programs on terminal by command g++ but i don't know how to run gpu based c++ programs like code containing graphics.h file
And pls suggest how to download all c++ libs and c++ in mac without xcode (because it is of 5.5gb)
Is it possible...
macOS has au unusual way of producing executables called app bundles. (Historically this is to reproduce on the HSFS file system what was part of the old OS 9 filesystem which associated attribute data to files).
Here is a link explaining how to launch an executable from a terminal. In short, use
open -a ApplicationName

cant run any c/c++ program [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
Anytime I try to run a simple C or C++ program in CLion or emacs, no output shows up.
EDIT: Using virtual environment, C was not installed properly.
CLion doesn't ship with a C/C++ compiler. You need to install your own compiler, and then set it up with CLion.
For windows, you can install:
MinGW
Cygwin (make sure you select gcc-core and g++ during setup)
CLion will detect these environments automatically during installation if you set them up in their default locations.

QT creator generate EXE file for windows or .dmg for mac osx [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have a question how to generate executables for Windows or .dmg for Mac OSX in Qt Creator. Please use easy way. I´m a beginner with QT creator.
How to build mac osx app without Mac and how to build linux app without linux.
I have a Windows 7 Professional.
well in case of windows when you build and run a project, an executable in already generated in you project build directly.
and if you want to deploy it you have to use the command
windeployqt "path to qt project"
Note: the command is present in C:\Qt\5.3\mingw482_32\bin
more info available here

Replace MPICH Installation by OpenMPI [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I currently have MPICH (release 3.1.4) installed on my machine (running Mac OS X 10.10.5). I would like to remove it and install OpenMPI instead but could find no instructions online on how to uninstall MPICH.
Is it sufficient to simply delete MPICH's directory? If so, where can I find it? I thought I had installed it in usr/local and did find some MPI-related files there (in a folder named include) but nothing that seemed like it was the whole thing.
Also, I am planning to use OpenMPI together with Intel's c++ compiler. Is there some preferred order of installation of these two?
Juste type make uninstall from the directory you compiled. That should do it.
Regarding openMPI and the Intel compiler, better installing the compiler before ans using it to build the package, but that's not compulsory, using GCC will do as well.

Minimal compile environment on Windows 8.1 [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Trying to compile this WinURL tool from source on Win 8.1:
http://www.chiark.greenend.org.uk/~sgtatham/winurl/
(src zip on that page if you want to take a look)
The reason is that I want to change the keybinding from Win+W to something else as Win 8.1 takes over Win+W for search and the tool no longer works on Win 8.1
What are my choices for a minimal dev env on Win 8.1? I'm not interested in installing GBs of tools if I can get away with something very simple that just lets me compile the above. Would something like Cygwin gcc or MinGW work or do I need some sort of Visual Studio and if so is there a simple free edition I can use?
If you're looking for a lightweight compiler-only solution, don't look beyond MinGW. You can install it and add its bin folder to the Environment PATH variable.
If you want an IDE too, I would recommend CodeBlocks, or DevC++.
I would recommend CodeBlocks over DevC++ as people report to DevC++ being slow, and also its development cycle is very slow.
These are all free and open source solutions. And lightweight.
I got it to compile just fine with MinGW using the following script:
del *.o winurl.exe
windres winurl.rc winurlres.o
gcc -c winurl.c
gcc -o winurl.exe winurl.o winurlres.o C:\MinGW\lib\libgdi32.a -mwindows
strip winurl.exe
del *.o