User forums > Using Code::Blocks

unrecognised emulation mode: windows error

(1/4) > >>

spflanze:
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:


--- Code: ---:: 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
--- End code ---

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:


--- Code: ----------------- 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))
 
--- End code ---

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?

stahta01:

--- Quote ---wxWidgets is built as a monolithic library ( Because MONOLITHIC=1  in the wxWidgets compilation command line )
--- End quote ---

Above you said you used MONOLITHIC=0!!!

YOU CAN NOT BUILD BOTH MONOLITHIC and NON MONOLITHIC in the same folder.

For the clean command to work you should use the same options as the build with the clean target added.

Did you use the same exact compiler to build wxWidgets and to build the wxWidgets application?

Tim S.

spflanze:
The two clean operations should have been done with MONOLITHIC=1. I missed that when I created the batch file. Thank you for noticing it. The error has been corrected, and the batch file is now as is attached (remove the .txt extension, it was added to get it to attach here). This correction did not make a difference though. I still get that same error.

I tried this corrected batch file on two versions of the compiler. One had the Posix option. The other I tried,- because the error seemed windows related, had the win32 option. But I got the same error with both.

Please suggest solutions.

stahta01:
If you really called the file "mingw32-make.bat" then it might not be safe to use "mingw32-make" in the batch file; but, that is not likely the cause of your issue. I will change the "mingw32-make" to "mingw32-make.exe" when I try to duplicate your problem.

Edit: I have a very slow computer; so, it will take at least a day for me to duplicate your issue.

Tim S.

stahta01:
What is the value you set for the linker for dynamic libs?
Linker for static libs?
These are toolchain settings.

--- Quote ---Linker for dynamic libs: ld.exe
Linker for static libs: ld.exe

--- End quote ---

The above are likely both wrong!

I will be trying

--- Code: ---Linker for dynamic libs: x86_64-w64-mingw32-g++.exe
Linker for static libs: ar.exe

--- End code ---

Tim S.

Navigation

[0] Message Index

[#] Next page

Go to full version