Fix Windows test linking: use main() instead of wmain() #169

Open
opened 2026-04-05 16:18:46 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @Wachhund on 3/25/2026

Summary

  • wxWidgets defines _UNICODE globally, which causes Catch2's catch_main.cpp to provide wmain() instead of main()
  • This leads to LNK2001: unresolved external symbol "main" for all test executables when building with BUILD_TESTS=ON on MSVC
  • Adds DO_NOT_USE_WMAIN compile definition to Catch2WithMain target

Test plan

  • Build with BUILD_TESTS=ON on Windows VS2022
  • Verify all test executables link successfully
  • No-op on Linux/macOS (_UNICODE is not defined there)
*Originally created by @Wachhund on 3/25/2026* ## Summary - wxWidgets defines `_UNICODE` globally, which causes Catch2's `catch_main.cpp` to provide `wmain()` instead of `main()` - This leads to `LNK2001: unresolved external symbol "main"` for all test executables when building with `BUILD_TESTS=ON` on MSVC - Adds `DO_NOT_USE_WMAIN` compile definition to `Catch2WithMain` target ## Test plan - [x] Build with `BUILD_TESTS=ON` on Windows VS2022 - [x] Verify all test executables link successfully - [ ] No-op on Linux/macOS (`_UNICODE` is not defined there)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/OrcaSlicer#169