Skip to content

fix: include QElapsedTimer for Windows build without HAVE_SERIALPORT#2195

Merged
ten9876 merged 1 commit intoten9876:mainfrom
NF0T:fix/serial-port-controller-windows-build
May 1, 2026
Merged

fix: include QElapsedTimer for Windows build without HAVE_SERIALPORT#2195
ten9876 merged 1 commit intoten9876:mainfrom
NF0T:fix/serial-port-controller-windows-build

Conversation

@NF0T
Copy link
Copy Markdown
Contributor

@NF0T NF0T commented Apr 30, 2026

Summary

Fixes a Windows build failure introduced by #2147 (serial PTT Win32 rewrite).

Problem

QElapsedTimer is included inside #ifdef HAVE_SERIALPORT in SerialPortController.h, but m_debounceTimer is declared inside the broader #if defined(HAVE_SERIALPORT) || defined(Q_OS_WIN) guard. On Windows when Qt6::SerialPort is not present (HAVE_SERIALPORT undefined), Q_OS_WIN is still true so the member block is compiled, but the QElapsedTimer include was skipped — resulting in:

error: 'QElapsedTimer' does not name a type
error: 'm_debounceTimer' was not declared in this scope

Fix

Move the #include <QElapsedTimer> to use the same #if defined(HAVE_SERIALPORT) || defined(Q_OS_WIN) guard as the member that depends on it.

Test Plan

  • Builds cleanly on Windows (MinGW GCC 13.1.0 / Qt 6.11.0) with Qt6::SerialPort disabled

🤖 Generated with Claude Code

QElapsedTimer was included only inside #ifdef HAVE_SERIALPORT, but
m_debounceTimer is declared inside #if defined(HAVE_SERIALPORT) ||
defined(Q_OS_WIN). On Windows when Qt6::SerialPort is not present,
Q_OS_WIN is true but the include was skipped, causing a build failure.

Move the QElapsedTimer include to match the broader guard.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@NF0T NF0T requested review from jensenpat and ten9876 as code owners April 30, 2026 13:36
Copy link
Copy Markdown
Contributor

@aethersdr-agent aethersdr-agent Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good — clean, minimal fix for a real build break.

The analysis is correct: #include <QElapsedTimer> at line 7 is guarded by #ifdef HAVE_SERIALPORT, but m_debounceTimer (line 118) lives inside the broader #if defined(HAVE_SERIALPORT) || defined(Q_OS_WIN) block. On Windows without Qt6::SerialPort, the member compiles but the include is skipped.

Moving the include to match the member's guard is the right fix. No scope creep, no bugs introduced.

Thanks for catching this @NF0T — nice write-up in the PR description too.

@ten9876 ten9876 merged commit b9bb3f3 into ten9876:main May 1, 2026
5 checks passed
@NF0T NF0T deleted the fix/serial-port-controller-windows-build branch May 1, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants