I have an "unrecognised emulation mode: windows" error from ld.exe. The procedure that lead up to it:
I compiled wxWdigets 3.1.2 using the command lines from
http://wiki.codeblocks.org/index.php/WxWindowsQuickRef . Below is the Windows 7 batch file I created to do the compilations:
:: Build_wxWidgets
:: ref http://wiki.codeblocks.org/index.php/WxWindowsQuickRef
:: Compiler download:
:: https://sourceforge.net/projects/mingw-64/files/latest/download
cd C:\wxWidgets-3.1.2\build\msw
mingw32-make.exe -f makefile.gcc MONOLITHIC=0 RC=1 SHARED=1 UNICODE=1 USE_OPENGL=1 BUILD=release clean
mingw32-make.exe -f makefile.gcc MONOLITHIC=0 RC=1 SHARED=1 UNICODE=1 USE_OPENGL=1 BUILD=debug clean
mingw32-make -f makefile.gcc BUILD=release SHARED=1 MONOLITHIC=1 UNICODE=1 CXXFLAGS=-fno-keep-inline-dllexport >mingw32-make-release.txt 2>&1
mingw32-make -f makefile.gcc BUILD=debug SHARED=1 MONOLITHIC=1 UNICODE=1 CXXFLAGS=-fno-keep-inline-dllexport >mingw32-make-debug.txt 2>&1
This batch file worked to compile the both the release and debug versions.
I then started up the latest nightly build of Code::Blocks which is svn 1168 built on April 20, 2019. I navigated to "Settings => Compiler => Toolchain executables (tab)" . I did these settings:
Selected compiler: GNU GCC Compiler
Compiler's installation directory: C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64
C compiler: gcc.exe
C++ Compiler: g++.exe
Linker for dynamic libs: ld.exe
Linker for static libs: ld.exe
Debugger: GDB/CDB debugger: Default
Resource compiler: windres.exe
Make program: mingw32-make.exe
I then navigated to File => New project...
In the "New from template" dialog that opened I selected "wxWidgets" project, and clicked on "Go".
The wxWidgets version I selected was wxWidgets 3.1.x.
After entering the project name I did these radio button selections:
Preferred GUI Builder: wxSmith
Application type: Frame based
In the "wxWidgets location" field I entered: "C:\wxWidgets-3.1.2"
In the next compiler and configurations window I left all at default, but made sure both the Debug and the Release checkboxes were checked.
In "wxWidgets Library Settings" checked all checkboxes to match the options wxWidgets was compiled under. Checked were:
Use wxWidgets DLL ( Because SHARED=1 in the wxWidgets compilation command line )
wxWidgets is built as a monolithic library ( Because MONOLITHIC=1 in the wxWidgets compilation command line )
Enable Unicode ( Because UNICODE=1 in the wxWidgets compilation command line )
In "Miscellaneous Settings" I did these settings:
Create Empty Project: unchecked
Create and use Precompiled header (PCH): checked
Configure Advanced Options: checked
In "Advanced options (GCC only)"
Use_WXDEBUG_and Debut wxWidgets.lib: checked
In the "Debug Target" radio buttons:
GUI Mode Application: selected
In the "Release Target" radio buttons:
GUI Mode Application: selected
Upon clicking on "Finish" a starter project was created.
I navigated to "Project => Build options". In the project tree I selected "Debug" and set:
"Produce debugging symbols: [-g]": checked
I then selected "Debug" in the Code::Blocks menu bar and navigated to: "Project => Rebuild"
I got the error:
-------------- Clean: Debug in TIA Designer (compiler: GNU GCC Compiler)---------------
Cleaned "TIA Designer - Debug"
-------------- Build: Debug in TIA Designer (compiler: GNU GCC Compiler)---------------
g++.exe -Wall -pipe -mthreads -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -D__WXDEBUG__ -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_dll\mswud -c "C:\Engineering Software\TIA Designer\wx_pch.h" -o wx_pch.h.gch\Debug_wx_pch_h_gch
windres.exe -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_dll\mswud -J rc -O coff -i C:\ENGINE~1\TI65BD~1\resource.rc -o obj\Debug\resource.res
g++.exe -Wall -pipe -mthreads -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -D__WXDEBUG__ -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_dll\mswud -c "C:\Engineering Software\TIA Designer\TIA_DesignerApp.cpp" -o obj\Debug\TIA_DesignerApp.o
g++.exe -Wall -pipe -mthreads -Winvalid-pch -include wx_pch.h -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DWX_PRECOMP -g -D__WXDEBUG__ -IC:\wxWidgets-3.1.2\include -IC:\wxWidgets-3.1.2\lib\gcc_dll\mswud -c "C:\Engineering Software\TIA Designer\TIA_DesignerMain.cpp" -o obj\Debug\TIA_DesignerMain.o
ld.exe -LC:\wxWidgets-3.1.2\lib\gcc_dll -o "bin\Debug\TIA Designer.exe" obj\Debug\TIA_DesignerApp.o obj\Debug\TIA_DesignerMain.o obj\Debug\resource.res -mthreads -lwxmsw31ud -mwindows
ld.exe: unrecognised emulation mode: windows
Supported emulations: i386pep i386pe
Process terminated with status 1 (0 minute(s), 13 second(s))
0 error(s), 0 warning(s) (0 minute(s), 13 second(s))
This appears to be related to the -mwindows option for ld.exe. I looked for, and did not find, a means to remove this option, or select alternatives to it. Where did this go wrong? What needs to be done to make this work?