How do I compile and link a 32-bit Windows executable using mingw-w64

That depends on which variant of toolchain you’re currently using. Both DWARF and SEH variants (which come starting from GCC 4.8.0) are only single-target. You can see it yourself by inspecting the directory structure of their distributions, i.e. they contain only the libraries with either 64- or 32-bit addressing, but not both. On the other … Read more

Serial Port (RS -232) Connection in C++

Please take a look here: RS-232 for Linux and Windows 1) Windows Serial Port Programming 2) Using the Serial Ports in Visual C++ 3) Serial Communication in Windows 1) You can use this with Windows (incl. MinGW) as well as Linux. Alternative you can only use the code as an example. 2) Step-by-step tutorial how … Read more

How to solve ——-undefined reference to `__chkstk_ms’——-on mingw

Here’s an authoritative answer, from a MinGW project administrator. Your problem arises because you continue to use an obsolete, (no longer maintained; no longer supported), version of GCC. Current versions of mingwrt are compiled using GCC-4.x, (I used GCC-4.8.2 for mingwrt-3.21 and its descendants), and this introduces the dependencies on __chkstk_ms, (which is provided by … Read more

Link to Python with MinGW

With nm and dlltool from binutils, you should be able to rebuild the library for gcc: echo EXPORTS > python32.def nm python32.lib | grep ” T _” | sed “s/.* T _//” >> python32.def dlltool –input-def python32.def –dllname python32 –output-lib libpython32.a python_test.c: #include “Python.h” int main(int argc, char *argv[]) { Py_Initialize(); PyRun_SimpleString(“from time import time,ctime\n” … Read more

Yet Another MinGW “gcc: error: CreateProcess: No such file or directory”

You shouldn’t add C:\MinGw\libexec\gcc\mingw32\4.7.2 to the path. Add: c:\MinGW\bin You may need to reboot to ensure that the path is made available to all processes properly. Another suggestion is to use a different MinGW distribution. It’s been a long time since I used an ‘official’ MinGW distribution because the installation steps were so byzantine and … Read more

How to use libraries compiled with MingW in MSVC?

Based on this error you put in a comment: error LNK2019: unresolved external symbol “int __cdecl openssl_call(struct ssl_State *,int,int,int)” (?openssl_call@@YAHPAUssl_State@@HHH@Z) referenced in function _main MyAPP.obj all other 4 errors are same only with other functions names Try putting extern “C” around your include files for openssl. For example: extern “C” { include “openssl.h” } using … Read more