Re: Error building wxWidgets 3.3.3 on Windows

PB <[email protected]> Wed, 29 Jul 2026 12:06:25 -0700 (PDT)
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
------=_Part_27856_2009188251.1785351985858
Content-Type: multipart/alternative; 
	boundary="----=_Part_27857_1832854000.1785351985858"

------=_Part_27857_1832854000.1785351985858
Content-Type: text/plain; charset="UTF-8"

Hi,

I could build wxWidgets 3.3.3 library as static monolithic with static CRT 
using CMake v4.4.0 and MSVS 2026 v18.8.2 just fine.

Firstly, I ran CMake:
cmake -G "Visual Studio 18 2026" -DwxBUILD_MONOLITHIC=ON 
-DwxBUILD_SHARED=OFF -DwxBUILD_USE_STATIC_RUNTIME=ON -DwxBUILD_SAMPLES=ALL 
-S ../wxWidgets-3.3.3 -B .

I then opened the resulting wxWidgets.slnx with MSVS and built it in the 
default x64 Debug configuration. 

There were two errors but they were in the archive and MFC samples, not the 
library: 
2>------ Build started: Project: mfc, Configuration: Debug x64 ------ 
3>------ Build started: Project: archive, Configuration: Debug x64 ------ 
2> mfctest.cpp 2>C:\Program Files\Microsoft Visual 
Studio\18\Community\VC\Tools\MSVC\14.51.36231\atlmfc\include\afxver_.h(81,2): 
error C1189: #error: Please use the /MD switch for _AFXDLL builds 2> 
(compiling source file '../../wxWidgets-3.3.3/samples/mfc/mfctest.cpp') 
3>LIBCMTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol 
main referenced in function "int __cdecl invoke_main(void)" 
(?invoke_main@@YAHXZ) 
3>D:\Dev\Desktop\Lib\wxWidgets-3.3.3-build-vc18_x64_mono-static\lib\vc_x64_lib\archive.exe 
: fatal error LNK1120: 1 unresolved externals 

The MFC sample probably (and understandably) does not like the static CRT 
linkage. 

The archive sample has linker subsystem set to console but uses  
wxIMPLEMENT_APP() instead of  wxIMPLEMENT_APP_CONSOLE().

Regards,
PB

-- 
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
--- 
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/wx-users/462b4151-2a41-48b9-bee4-fb3e673d33f4n%40googlegroups.com.

------=_Part_27857_1832854000.1785351985858
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div>Hi,</div><div><br /></div><div>I could build wxWidgets 3.3.3 library a=
s static monolithic with static CRT using CMake v4.4.0 and MSVS 2026 v18.8.=
2 just fine.</div><div><br /></div><div>Firstly, I ran CMake:</div><div><sp=
an style=3D"font-family: Courier New;">cmake -G "Visual Studio 18 2026" -Dw=
xBUILD_MONOLITHIC=3DON -DwxBUILD_SHARED=3DOFF -DwxBUILD_USE_STATIC_RUNTIME=
=3DON -DwxBUILD_SAMPLES=3DALL -S ../wxWidgets-3.3.3 -B .</span></div><div><=
br /></div><div>I then opened the resulting=C2=A0wxWidgets.slnx with MSVS a=
nd built it in the default x64 Debug configuration.=C2=A0</div><div><br /><=
/div><div>There were two errors but they were in the archive and MFC sample=
s, not the library:=C2=A0</div><div>
<span style=3D"font-family: &quot;Cascadia Mono&quot;; font-size: 9pt; colo=
r: rgb(0, 0, 0);">2&gt;------ Build started: Project: mfc, Configuration: D=
ebug x64 ------
3&gt;------ Build started: Project: archive, Configuration: Debug x64 -----=
-
2&gt;  mfctest.cpp
2&gt;C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14=
.51.36231\atlmfc\include\afxver_.h(81,2): error C1189: #error:  Please use =
the /MD switch for _AFXDLL builds
2&gt;  (compiling source file '../../wxWidgets-3.3.3/samples/mfc/mfctest.cp=
p')
3&gt;LIBCMTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol =
main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@=
YAHXZ)
3&gt;D:\Dev\Desktop\Lib\wxWidgets-3.3.3-build-vc18_x64_mono-static\lib\vc_x=
64_lib\archive.exe : fatal error LNK1120: 1 unresolved externals</span>
</div><div><br /></div><div>The MFC sample probably (and understandably) do=
es not like the static CRT linkage.=C2=A0</div><div><br /></div><div>The ar=
chive sample has linker subsystem set to console but uses=C2=A0
<span style=3D"font-family: &quot;Cascadia Mono&quot;; font-size: 9pt; colo=
r: rgb(0, 0, 0);"><span style=3D"color: rgb(111, 0, 138);">wxIMPLEMENT_APP<=
/span></span>() instead of=C2=A0
<span style=3D"font-family: &quot;Cascadia Mono&quot;; font-size: 9pt; colo=
r: rgb(0, 0, 0);"><span style=3D"color: rgb(111, 0, 138);">wxIMPLEMENT_APP_=
CONSOLE</span></span>().</div><div><br /></div><div>Regards,</div><div>PB</=
div>

<p></p>

-- <br />
Please read <a href=3D"https://www.wxwidgets.org/support/mlhowto.htm">https=
://www.wxwidgets.org/support/mlhowto.htm</a> before posting.<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;wx-users&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">wx-users+u=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
wx-users/462b4151-2a41-48b9-bee4-fb3e673d33f4n%40googlegroups.com?utm_mediu=
m=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/wx-users/4=
62b4151-2a41-48b9-bee4-fb3e673d33f4n%40googlegroups.com</a>.<br />

------=_Part_27857_1832854000.1785351985858--

------=_Part_27856_2009188251.1785351985858--