Linker error for Win32 app with MSVS2026

7 views
Skip to first unread message

Gatti Gianluca

unread,
Jul 10, 2026, 5:49:10 AM (18 hours ago) Jul 10
to wx-u...@googlegroups.com
Hello guys,

I was trying to build a (simple) wxWidgets application for x86 platform.
Therefore, I built wxWidgets from source: I choose wx_vc18 solution and built it as DLL Release - Win32.
I extracted the wxWidgets source code .zip in the folder C:\wx\source_3.3.3

When compiling my app, I got a lot of linker error, in particular LNK2002 "unresolved external symbol..."

I didn't want to use the wxwidgets.props file because I noticed it has some problems with different build configurations and other ones... therefore I decided to explicitly define my own all the settings, as follow:

  • C/C++
    • General -> Additional Include Directories:
      • C:\wx\source_3.3.3\include
      • C:\wx\source_3.3.3\lib\vc_dll\mswu
    • Preprocessor Definitions:
      • _CRT_SECURE_NO_WARNINGS
      • _UNICODE
  • Linker
    • Additional Library Directories:
      • C:\wx\source_3.3.3\lib\vc_dll\mswu
    • System -> SubSystem:
      • Windows (/SUBSYSTEM:WINDOWS)

I think my goal is common, so maybe someone has already dealt with the problem.
Thank you in advance,

    Gianluca



Richard

unread,
Jul 10, 2026, 10:18:21 AM (14 hours ago) Jul 10
to wx-u...@googlegroups.com
In article <AS4PR10MB6110B23632...@AS4PR10MB6110.EURPRD10.PROD.OUTLOOK.COM> you write:
>I was trying to build a (simple) wxWidgets application for x86 platform.
>Therefore, I built wxWidgets from source: I choose wx_vc18 solution and
>built it as DLL Release - Win32.
>I extracted the wxWidgets source code .zip in the folder C:\wx\source_3.3.3
>
>When compiling my app, I got a lot of linker error, in particular LNK2002
>"unresolved external symbol..."

It's simpler to just use CMake to generate the project and solution.

With the below CMakeUserPresets.json file in the wxWidgets source
directory, next to CMakePresets.json, the following builds and links
everything 32-bit with no problem:

First, configure to generate project/solution files:

cmake --preset default32

Then you can either build from the solution or with cmake:

cmake --build --preset default32

Pay attention to the output from the first command to see where
wxWidgets wants to write the project/solution files by default. I
place them elsewhere, but omitted that customization to keep this
example simple.

-- Richard

====== CMakeUserPresets.json
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 23,
"patch": 0
},
"configurePresets": [
{
"name": "default32",
"displayName": "Configure with default 32-bit settings",
"inherits": [
"with_samples",
"with_tests"
],
"architecture": {
"value": "Win32",
"strategy": "set"
},
"generator": "Visual Studio 18 2026"
}

],
"buildPresets": [
{
"name": "default32",
"displayName": "Build with default 32-bit settings",
"configurePreset": "default32"
}

],
"testPresets": [
{
"name": "default32",
"displayName": "Test with default 32-bit settings",
"configurePreset": "default32",
"configuration": "Release",
"output": {
"outputOnFailure": true
}
}
],
"workflowPresets": [
{
"name": "default32",
"displayName": "Workflow with default 32-bit settings: configure, build and test",
"steps": [
{
"type": "configure",
"name": "default32"
},
{
"type": "build",
"name": "default32"
},
{
"type": "test",
"name": "default32"
}
]
}
]
}
====== CMakeUserPresets.json

--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Terminals Wiki <http://terminals-wiki.org>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>

Gatti Gianluca

unread,
Jul 10, 2026, 10:26:56 AM (14 hours ago) Jul 10
to wx-u...@googlegroups.com
Thank you, but with the MSVS compiler I prefer to use the "Visual Studio" way to manage the building of the project than the cmake one.
On the other hand, for the x64 platform and the relative wxWidgets pre-built binary it works; so I don't understand why it couldn't work for the x86 (Win32) platform.

    Gianluca

Da: wx-u...@googlegroups.com <wx-u...@googlegroups.com> per conto di Richard <lega...@xmission.com>
Inviato: venerdì 10 luglio 2026 16:18
A: wx-u...@googlegroups.com <wx-u...@googlegroups.com>
Oggetto: Re: Linker error for Win32 app with MSVS2026
 
In article <AS4PR10MB6110B236328ACF072C56B7659EFD2@ AS4PR10MB6110. EURPRD10. PROD. OUTLOOK. COM> you write: >I was trying to build a (simple) wxWidgets application for x86 platform. >Therefore, I built wxWidgets from source: I choose
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
This message came from outside your organization.
 
ZjQcmQRYFpfptBannerEnd
In article <AS4PR10MB6110B23632...@AS4PR10MB6110.EURPRD10.PROD.OUTLOOK.COM> you write:
>I was trying to build a (simple) wxWidgets application for x86 platform.
>Therefore, I built wxWidgets from source: I choose wx_vc18 solution and
>built it as DLL Release - Win32.
>I extracted the wxWidgets source code .zip in the folder C:\wx\source_3.3.3
>
>When compiling my app, I got a lot of linker error, in particular LNK2002
>"unresolved external symbol..."

It's simpler to just use CMake to generate the project and solution.

With the below CMakeUserPresets.json file in the wxWidgets source
directory, next to CMakePresets.json, the following builds and links
everything 32-bit with no problem:

First, configure to generate project/solution files:

cmake --preset default32

Then you can either build from the solution or with cmake:

cmake --build --preset default32

Pay attention to the output from the first command to see where
wxWidgets wants to write the project/solution files by default.  I
place them elsewhere, but omitted that customization to keep this
example simple.

-- Richard

====== CMakeUserPresets.json
{
  "version": 6,
  "cmakeMinimumRequired": {
    "major": 3,
    "minor": 23,
    "patch": 0
  },
  "configurePresets": [
    {
        "name": "default32",
        "displayName": "Configure with default 32-bit settings",
        "inherits": [
            "with_samples",
            "with_tests"
        ],
        "architecture": {
          "value": "Win32",
          "strategy": "set"
        },
        "generator": "Visual Studio 18 2026"
    }

  ],
  "buildPresets": [
    {
      "name": "default32",
      "displayName": "Build with default 32-bit settings",
      "configurePreset": "default32"
    }

  ],
  "testPresets": [
    {
      "name": "default32",
      "displayName": "Test with default 32-bit settings",
      "configurePreset": "default32",
      "configuration": "Release",
      "output": {
        "outputOnFailure": true
      }
    }
  ],
  "workflowPresets": [
    {
      "name": "default32",
      "displayName": "Workflow with default 32-bit settings: configure, build and test",
      "steps": [
        {
          "type": "configure",
          "name": "default32"
        },
        {
          "type": "build",
          "name": "default32"
        },
        {
          "type": "test",
          "name": "default32"
        }
      ]
    }
  ]
}
====== CMakeUserPresets.json

--
"The Direct3D Graphics Pipeline" free book <https://urldefense.com/v3/__http://tinyurl.com/d3d-pipeline__;!!EAvW5M_HCdSncw!LpYv-OQnMY-pBmOGiyYgzn-GnaoJqP-W_WSZ8vST3sZXy2m8GQaHJ_3Ctlj5DHJEqXphMWUVXTMN1-_BTRwhSl6jkizBAyU$>
            The Terminals Wiki <https://urldefense.com/v3/__http://terminals-wiki.org__;!!EAvW5M_HCdSncw!LpYv-OQnMY-pBmOGiyYgzn-GnaoJqP-W_WSZ8vST3sZXy2m8GQaHJ_3Ctlj5DHJEqXphMWUVXTMN1-_BTRwhSl6jVzAfTTU$>
     The Computer Graphics Museum <https://urldefense.com/v3/__http://computergraphicsmuseum.org__;!!EAvW5M_HCdSncw!LpYv-OQnMY-pBmOGiyYgzn-GnaoJqP-W_WSZ8vST3sZXy2m8GQaHJ_3Ctlj5DHJEqXphMWUVXTMN1-_BTRwhSl6jSWLvJSI$>
  Legalize Adulthood! (my blog) <https://urldefense.com/v3/__http://legalizeadulthood.wordpress.com__;!!EAvW5M_HCdSncw!LpYv-OQnMY-pBmOGiyYgzn-GnaoJqP-W_WSZ8vST3sZXy2m8GQaHJ_3Ctlj5DHJEqXphMWUVXTMN1-_BTRwhSl6jjVQsERo$>

-- 
Please read https://urldefense.com/v3/__https://www.wxwidgets.org/support/mlhowto.htm__;!!EAvW5M_HCdSncw!LpYv-OQnMY-pBmOGiyYgzn-GnaoJqP-W_WSZ8vST3sZXy2m8GQaHJ_3Ctlj5DHJEqXphMWUVXTMN1-_BTRwhSl6j7zHESy4$ 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 wx-users+u...@googlegroups.com.
To view this discussion visit https://urldefense.com/v3/__https://groups.google.com/d/msgid/wx-users/E1wiC3S-000000001F9-34MJ*40shell.xmission.com__;JQ!!EAvW5M_HCdSncw!LpYv-OQnMY-pBmOGiyYgzn-GnaoJqP-W_WSZ8vST3sZXy2m8GQaHJ_3Ctlj5DHJEqXphMWUVXTMN1-_BTRwhSl6jZZNFy0k$.

Maarten Bent

unread,
Jul 10, 2026, 5:21:23 PM (7 hours ago) Jul 10
to wx-u...@googlegroups.com
You need to list all the required libraries (like wxmsw33u_core.lib and wxbase33u.liband core) in Linker -> Input -> dependencies.
And you need to specify WXUSINGDLL in C/C++ -> Preprocessor -> definitions.
You can use "samples\minimal\minimal.vcxproj" as example.

CMake will generate a Visual Studio project with all the correct settings automatically.

Maarten
--
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 wx-users+u...@googlegroups.com.

Kenneth Porter

unread,
Jul 10, 2026, 9:31:54 PM (3 hours ago) Jul 10
to wx-u...@googlegroups.com
Note that include\msvc\wx\setup.h eliminates the need to list libraries
in a Visual Studio project by using "#pragma comment" directives. One
can "compile to preprocessed" to verify that this file is included
through the regular wx header hierarchy and that the names are properly
expanded.

I hadn't noticed this directive before but it can be used to list all
includes as they're compiled:

https://learn.microsoft.com/en-us/cpp/build/reference/showincludes-list-include-files?view=msvc-170


Reply all
Reply to author
Forward
0 new messages