How to tell make to use mingw32 instead of gcc - c++

I'm trying to build wkhtmltopdf for Windows on an Ubuntu box. I haven't done much with cross-compiling in the past, but I have installed the Mingw32 compiler and am having trouble figuring out how to build qt to target Windows instead of Linux. Right now I am not sure how to tell ./configure to use Mingw32 to build a windows version of Qt when I run make. Can anybody shed some light on how to do this?
I have tried building wkhtmltopdf on Windows in the past, but got stuck at the step where you need to run qmake after building Qt, which is why I am trying to build on a native linux environment instead.

Related

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

libconfig 1.4.9 compile for Windows

I have a little trouble here. I know how to compile libconfig for linux with ./configure file and make, but i have no idea how to do the same for the windows. INSTALL file doesn't say anything about compiling it on windows or cross compiling it to windows from linux. Official site (http://www.hyperrealm.com/libconfig/) says that I can do that with Visual Studio 2008 (hell no) or gcc. But I don't know how. Can someone help me?
I've cross compiled the api from Linux for Windows using
./configure --build x86_64-unknown-linux-gnu --host x86_64-w64-mingw32 --prefix=$PWD/bin.
That configures the make files to use the 64 bit version of mingw to build.
The --prefix=$PWD/bin makes it so that when you type make install it will install to the root folder of the build under /bin. I did that so it wouldn't mix windows libraries in with my linux libraries.
I made the mistake of using i686 as the platform for mingw. Don't do that. It won't link to your project if you do.

How do I set up OpenCV for MinGW project?

I regularly use Code::Blocks and MinGW for my C/C++ projects. I would like to be able to use OpenCV, since it has a nice library for computer vision projects. They have dropped support for MinGW. I have heard you can build it on your own somehow, but I have no experience doing this with 3rd party libraries. Can someone explain how to build it in a simple way for MinGW?
There is, or at least there was at least until 2.4.6, precompiled version of opencv that works out of the box with mingw as long as you use the dw2(standard) version of mingw.
since i needed sjlj support i had to build my own version of openCV 2.4.6
I did he following - i am pretty sure it will work for the current openCV version as well
Setup your preferred Mingw Environment - i would strongly recommend to use gcc 4.5 or newer
Intstall Msys
Intall Cmake - you can get a binary package
Start the Cmake GUI
Select the openCV source folder
Click Configure and select MSYS-Makfiles
Errors in the first run of Configure might be resolved if you run Configure again
Click Generate
use MSYS make to run the generated makefile
Copy all desired libraries and include files to your mingw-installation or your project