Error trying to compile a wxWidgets program

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
daniel1960
In need of some credit
In need of some credit
Posts: 2
Joined: Tue Jan 31, 2023 5:58 pm

Error trying to compile a wxWidgets program

Post by daniel1960 »

I follow the PB guide to the letter and when I try to build the first program I get this please help me!!!

||=== Build: Debug in TEST98 (compiler: msys2-mingw-w64-x86_64) ===|
G:\Programming\Windows Projects\TEST98\resource.rc|4|fatal error: when writing output to : Broken pipe|
||can't open icon file `wx/msw/std.ico': No such file or directory|
||preprocessing failed.|
||=== Build finished: 3 error(s), 0 warning(s) (0 minute(s), 6 second(s)) ===|


-------------- Build: Debug in TEST98 (compiler: msys2-mingw-w64-x86_64)---------------

windres.exe -IC:\dev\libs\wxWidgets-3.2.1\include -IC:\dev\libs\wxWidgets-3.2.1\lib\gcc_dll\mswud -J rc -O coff -i "G:\Programming\Windows Projects\TEST98\resource.rc" -o obj\Debug\resource.res
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -g -D__WXDEBUG__ -IC:\dev\libs\wxWidgets-3.2.1\include -IC:\dev\libs\wxWidgets-3.2.1\lib\gcc_dll\mswud -IC:\dev\libs\wxWidgets-3.2.1\include -c "G:\Programming\Windows Projects\TEST98\TEST98App.cpp" -o obj\Debug\TEST98App.o
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -g -D__WXDEBUG__ -IC:\dev\libs\wxWidgets-3.2.1\include -IC:\dev\libs\wxWidgets-3.2.1\lib\gcc_dll\mswud -IC:\dev\libs\wxWidgets-3.2.1\include -c "G:\Programming\Windows Projects\TEST98\TEST98Main.cpp" -o obj\Debug\TEST98Main.o
g++.exe -LC:\dev\libs\wxWidgets-3.2.1\lib\gcc_dll -LC:\dev\libs\wxWidgets-3.2.1\lib\gcc_dll -o bin\Debug\TEST98.exe obj\Debug\TEST98App.o obj\Debug\TEST98Main.o obj\Debug\resource.res -mthreads -lwxmsw32ud_webview -lwxmsw32ud_stc -lwxmsw32ud_propgrid -lwxmsw32ud_ribbon -lwxmsw32ud_richtext -lwxmsw32ud_xrc -lwxmsw32ud_aui -lwxmsw32ud_media -lwxbase32ud_net -lwxmsw32ud_gl -lwxbase32ud_xml -lwxmsw32ud_html -lwxmsw32ud_core -lwxbase32ud -lopengl32 -lglu32 -mwindows
G:\Programming\Windows Projects\TEST98\resource.rc:4: fatal error: when writing output to : Broken pipe
compilation terminated.
windres.exe: can't open icon file `wx/msw/std.ico': No such file or directory
windres.exe: preprocessing failed.
Process terminated with status 1 (0 minute(s), 1 second(s))

Process terminated with status 0 (0 minute(s), 6 second(s))
3 error(s), 0 warning(s) (0 minute(s), 6 second(s))
Last edited by daniel1960 on Tue Jan 31, 2023 11:26 pm, edited 3 times in total.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Error trying to compile a wxWidgets program

Post by PB »

For some reason, user "daniel1960" deleted their post starting this thread, where they reported a windres error when building a wxWidgets application with Code::Blocks. My post responded to it.

Is your resource.rc file unmodified (as created by the C::B wizard)? If not, please post its content (as attachment).

Please post also the full build log from Code::Blocks, make sure it includes the line starting with "windres".

I have just tried and it still works
-------------- Build: Debug in testwx321 (compiler: msys2-mingw-w64-x86_64)---------------

windres.exe -IC:\dev\libs\wxWidgets-3.2\include -IC:\dev\libs\wxWidgets-3.2\lib\gcc_dll\mswud -DwxUSE_DPI_AWARE_MANIFEST=2 -J rc -O coff -i C:\dev\TESTWX~1\resource.rc -o obj\Debug\resource.res
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -std=c++17 -g -D__WXDEBUG__ -IC:\dev\libs\wxWidgets-3.2\include -IC:\dev\libs\wxWidgets-3.2\lib\gcc_dll\mswud -c C:\dev\testwx321\testwx321App.cpp -o obj\Debug\testwx321App.o
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -Wall -std=c++17 -g -D__WXDEBUG__ -IC:\dev\libs\wxWidgets-3.2\include -IC:\dev\libs\wxWidgets-3.2\lib\gcc_dll\mswud -c C:\dev\testwx321\testwx321Main.cpp -o obj\Debug\testwx321Main.o
g++.exe -LC:\dev\libs\wxWidgets-3.2\lib\gcc_dll -o bin\Debug\testwx321.exe obj\Debug\testwx321App.o obj\Debug\testwx321Main.o obj\Debug\resource.res -mthreads -lwxmsw32ud_core -lwxbase32ud -mwindows
Output file is bin\Debug\testwx321.exe with size 908.47 KB
GCC v12.2.0, windres v2.39

Edit: I also tried building a project where both the C::B project and wxWidgets were stored in paths with spaces, still worked flawlessly.
Last edited by PB on Tue Jan 31, 2023 9:13 pm, edited 1 time in total.
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 548
Joined: Fri Nov 03, 2006 2:00 pm

Re: Error trying to compile a wxWidgets program

Post by stahta01 »

windres is the one command in MinGW GCC that is the most often broken for spaces in the path.
That is why Code::Blocks normally changes paths to windres to the short form.

The problem is likely Code::Blocks or windres caused.

Tim S.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Error trying to compile a wxWidgets program

Post by PB »

stahta01 wrote: Wed Feb 01, 2023 9:36 pm windres is the one command in MinGW GCC that is the most often broken for spaces in the path.
That is why Code::Blocks normally changes paths to windres to the short form.

The problem is likely Code::Blocks or windres caused.
As can be seen in the build log in the miraculously reappeared (and edited) OP, the space containing path is passed to windres as is and not converted to a short name, unlike in my log. I have learned that one one computer, I had short name (8.3) aliasing disabled for some volumes, I wonder what happens when C::B attempts to use 8.3 name on a volume which does not have them...
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Error trying to compile a wxWidgets program

Post by doublemax »

PB wrote: Thu Feb 02, 2023 7:10 am As can be seen in the build log in the miraculously reappeared (and edited) OP
When he edited it, it had to be moderated again, therefore it was invisible for that time.
Use the source, Luke!
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Error trying to compile a wxWidgets program

Post by PB »

As seen in the OPs log, the windres was passed a quoted long path with spaces as its input. I have just tested this in the command line and the file was compiled without any problems.

I have no idea why C::B used a quoted long path here and not the short path it usually does. Either it has a setting I am not aware of, or it also uses quotes on any path with spaces (and a long path was returned when a short path could not be provided).

EDIT
I tried creating a project on a volume where short name generation is disabled:

Code: Select all

C:\WINDOWS\system32>FSUTIL.EXE 8dot3name query D:
The volume state is: 1 (8dot3 name creation is disabled).
The registry state is: 2 (Per volume setting - the default).

Based on the above settings, 8dot3 name creation is disabled on D:
When this is the case, the API for providing a short path returns the original long path. The resource compilation still works, as C::B correctly quotes such paths and windres (at least as of binutils v2.39 I have) can handle it:
-------------- Build: Debug in TEST98 (compiler: msys2-mingw-w64-x86_64)---------------

windres.exe -IC:\dev\libs\wxWidgets-3.2\include -IC:\dev\libs\wxWidgets-3.2\lib\gcc_dll\mswud -DwxUSE_DPI_AWARE_MANIFEST=2 -J rc -O coff -i "D:\Programming\Windows Projects\TEST98\resource.rc" -o obj\Debug\resource.res
g++.exe -Wall -std=c++17 -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -g -D__WXDEBUG__ -IC:\dev\libs\wxWidgets-3.2\include -IC:\dev\libs\wxWidgets-3.2\lib\gcc_dll\mswud -c "D:\Programming\Windows Projects\TEST98\TEST98App.cpp" -o obj\Debug\TEST98App.o
g++.exe -Wall -std=c++17 -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -g -D__WXDEBUG__ -IC:\dev\libs\wxWidgets-3.2\include -IC:\dev\libs\wxWidgets-3.2\lib\gcc_dll\mswud -c "D:\Programming\Windows Projects\TEST98\TEST98Main.cpp" -o obj\Debug\TEST98Main.o
g++.exe -LC:\dev\libs\wxWidgets-3.2\lib\gcc_dll -o bin\Debug\TEST98.exe obj\Debug\TEST98App.o obj\Debug\TEST98Main.o obj\Debug\resource.res -mthreads -lwxmsw32ud_webview -lwxmsw32ud_stc -lwxmsw32ud_propgrid -lwxmsw32ud_ribbon -lwxmsw32ud_richtext -lwxmsw32ud_xrc -lwxmsw32ud_aui -lwxmsw32ud_media -lwxbase32ud_net -lwxmsw32ud_gl -lwxbase32ud_xml -lwxmsw32ud_html -lwxmsw32ud_core -lwxbase32ud -lopengl32 -lglu32 -mwindows
Output file is bin\Debug\TEST98.exe with size 908.32 KB
Process terminated with status 0 (0 minute(s), 3 second(s))
0 error(s), 0 warning(s) (0 minute(s), 3 second(s))
As can be seen, my windres command line is basically the same as the OPs, yet mine compiles.
daniel1960
In need of some credit
In need of some credit
Posts: 2
Joined: Tue Jan 31, 2023 5:58 pm

Re: Error trying to compile a wxWidgets program

Post by daniel1960 »

thank you all is great to see that you all ready to help. You are awsome!
I fix my problem the 2 files for the wizard, wizard wizard,script were copied in the wrong place.

Thank You Daniel
Post Reply