User forums > Help
wxWidgets Hello World! fails to build
Frank_CB:
@PB:
What tells you that 'wxWidgets Hello World!' should be handled as a wxWidgets GUI Project. I've just attempted to use the wxWidgets template to build a wxWidgets GUI Project. I've replaced the code of appmain.cpp with the code of 'wxWidgets' Hello Wold!'. The build log follows:
--- Code: ---------------- Clean: Release in HW2 (compiler: GNU GCC 13.1.0 Mingw64 Compiler)---------------
Cleaned "HW2 - Release"
-------------- Build: Release in HW2 (compiler: GNU GCC 13.1.0 Mingw64 Compiler)---------------
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -IC:\wxWidgets-3.2.2.1\include -IC:\wxWidgets-3.2.2.1\lib\gcc_dll\mswu -c C:\Sandbox1\HW2\HW2App.cpp -o obj\Release\HW2App.o
g++.exe -pipe -mthreads -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -IC:\wxWidgets-3.2.2.1\include -IC:\wxWidgets-3.2.2.1\lib\gcc_dll\mswu -c C:\Sandbox1\HW2\HW2Main.cpp -o obj\Release\HW2Main.o
windres.exe -IC:\wxWidgets-3.2.2.1\include -IC:\wxWidgets-3.2.2.1\lib\gcc_dll\mswu -J rc -O coff -i C:\Sandbox1\HW2\resource.rc -o obj\Release\resource.res
g++.exe -LC:\wxWidgets-3.2.2.1\lib\gcc_dll -o bin\Release\HW2.exe obj\Release\HW2App.o obj\Release\HW2Main.o obj\Release\resource.res -mthreads -lwxmsw32u -mwindows
In file included from C:\wxWidgets-3.2.2.1\include/wx/defs.h:45,
from C:\wxWidgets-3.2.2.1\include/wx/wx.h:14,
from C:\Sandbox1\HW2\HW2Main.cpp:2:
C:\wxWidgets-3.2.2.1\include/wx/platform.h:162:11: fatal error: wx/setup.h: No such file or directory
162 | #include "wx/setup.h"
| ^~~~~~~~~~~~
compilation terminated.
In file included from C:\wxWidgets-3.2.2.1\include/wx/defs.h:45,
from C:\wxWidgets-3.2.2.1\include/wx/event.h:14,
from C:\wxWidgets-3.2.2.1\include/wx/app.h:19,
from C:\Sandbox1\HW2\HW2App.h:13,
from C:\Sandbox1\HW2\HW2App.cpp:14:
C:\wxWidgets-3.2.2.1\include/wx/platform.h:162:11: fatal error: wx/setup.h: No such file or directory
162 | #include "wx/setup.h"
| ^~~~~~~~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 1 second(s))
Process terminated with status 1 (0 minute(s), 1 second(s))
Process terminated with status 0 (0 minute(s), 3 second(s))
2 error(s), 0 warning(s) (0 minute(s), 3 second(s))
--- End code ---
Using the wxWidgets template involves several dialogs, each with several choices. Is this what you were talking about? I'll have to work longer on this project!
Much appreciation!
PB:
I think it would be easier if you followed my guide linked above, or at least its chapter 4.8 which explains what is actually needed in a C::B wxWidgets project. But the wizard should work as well, as long as you know what you are doing.
Anyway, I see at least two issues with your last build:
1. The library folder is different than before (gcc_dll vs gcc_dll64): are you sure your build (including the build-specific setup.h) is really there?
2. You attempt to link against the monolithic wxWidgets library (-lwxmsw32u): is your wxWidgets build really monolithic (MONOLITHIC=1) and not the default multilib?
If you do not want to follow a guide, I strongly advise looking at least at the official docs. IMO, the trial and error is not the best way here, wasting lot of time and effort.
Frank_CB:
@PB:
I'll take a look at your guide (took a quick peek at it after your last reply). Yes, the library is monolithic and WX_CFG=64.
Your guide is a tutorial rather than a reference manual. Just what I need!
Thanks again!
Frank_CB:
@PB:
I followed the guide. Used compiler from CB13318, Recompiled wxWidgets libraries to multilib. Build log for debug target follows:
--- Code: ----------------- Build: Debug in Test (compiler: GNU GCC 13.1.0 Mingw64 Compiler)---------------
g++.exe -pipe -mthreads -DwxUSE_DPI_AWARENESS_MANIFEST=2 -DwxUSE_AWARE_MANIF=2 -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DwxUSE_DPI_AWARE_MANIFEST=2 -D__WXDEBUG__ -IC:\wxWidgets-3.2.2.1\include -IC:\wxWidgets-3.2.2.1\lib\gcc_dll64\mswud -c C:\Sandbox1\Test\TestApp.cpp -o obj\Debug\TestApp.o
g++.exe -pipe -mthreads -DwxUSE_DPI_AWARENESS_MANIFEST=2 -DwxUSE_AWARE_MANIF=2 -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DwxUSE_DPI_AWARE_MANIFEST=2 -D__WXDEBUG__ -IC:\wxWidgets-3.2.2.1\include -IC:\wxWidgets-3.2.2.1\lib\gcc_dll64\mswud -c C:\Sandbox1\Test\TestMain.cpp -o obj\Debug\TestMain.o
g++.exe -LC:\wxWidgets-3.2.2.1\lib\gcc_dll -o bin\Debug\Test.exe obj\Debug\TestApp.o obj\Debug\TestMain.o obj\Debug\resource.res -mthreads -mwindows -lwxmsw32ud_core -lwxbase32ud -mwindows
C:/Mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwxmsw32ud_core: No such file or directory
C:/Mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwxbase32ud: No such file or directory
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 25 second(s))
3 error(s), 0 warning(s) (0 minute(s), 25 second(s))
--- End code ---
What have I missed?
PB:
--- Quote from: Frank_CB on July 24, 2023, 04:26:05 am ---@PB:
I followed the guide. What have I missed?
--- End quote ---
It seems you did not follow my guide. For example, it makes no sense to pass C++ compiler this (the second one does not even exist)
--- Code: ----DwxUSE_DPI_AWARENESS_MANIFEST=2 -DwxUSE_AWARE_MANIF=2
--- End code ---
While this should do no harm, it can be seen that some steps were missed or done incorrectly.
More importantly, the command line is a mess
--- Quote ---g++.exe -pipe -mthreads -DwxUSE_DPI_AWARENESS_MANIFEST=2 -DwxUSE_AWARE_MANIF=2 -D__GNUWIN32__ -D__WXMSW__ -DWXUSINGDLL -DwxUSE_UNICODE -DwxUSE_DPI_AWARE_MANIFEST=2 -D__WXDEBUG__ -IC:\wxWidgets-3.2.2.1\include -IC:\wxWidgets-3.2.2.1\lib\gcc_dll64\mswud -c C:\Sandbox1\Test\TestMain.cpp -o obj\Debug\TestMain.o
--- End quote ---
vs
--- Quote ---g++.exe -LC:\wxWidgets-3.2.2.1\lib\gcc_dll -o bin\Debug\Test.exe obj\Debug\TestApp.o obj\Debug\TestMain.o obj\Debug\resource.res -mthreads -mwindows -lwxmsw32ud_core -lwxbase32ud -mwindowss
--- End quote ---
why are you using two wxWidgets library folders, this is obviously wrong?
Sorry, but it is pretty clear you did not follow the guide as the wizard would have set the folder correctly (and also added the resource file).
Did you at least, as instructed, build and run the minimal sample to check whether the wxWidgets library build was successful?
You should also read the build output: if you did, you would have noticed the problems as they are hard to miss.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version