Skip to content

Fix MSVC build errors: _countof undefined and duplicate macro redefinition#3

Closed
Copilot wants to merge 4 commits intomainfrom
copilot/create-remote-command-tools
Closed

Fix MSVC build errors: _countof undefined and duplicate macro redefinition#3
Copilot wants to merge 4 commits intomainfrom
copilot/create-remote-command-tools

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 14, 2026

Two independent MSVC build failures in SysExec.cpp when building with /WX:

  • 17× C3861_countof not found; <stdlib.h> (which defines it) was not included.
  • C4005 → C2220WIN32_LEAN_AND_MEAN and _WIN32_WINNT were #defined in source but already injected by CMake's target_compile_definitions (-DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600), causing macro redefinition warnings promoted to errors by /WX.

Changes

  • SysExec.cpp — add #include <stdlib.h> for _countof; remove the two duplicate #define lines (macros are owned by CMake).
  • CMakeLists.txt (prior fix) — scope /O2 /Oi /GL and /LTCG to non-Debug configs only to avoid incompatibility with CMake-injected /RTC1 and /Od in Debug; fix /MT$<$<CONFIG:Debug>:d> → proper per-config generator expressions.

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

…cutor

Co-authored-by: LoveDoLove <67772009+LoveDoLove@users.noreply.github.com>
Copilot AI changed the title [WIP] Add remote command tools for NT AUTHORITY privileges Add SysExec: lightweight C++ NT AUTHORITY\SYSTEM / remote command executor Mar 14, 2026
Copilot AI requested a review from LoveDoLove March 14, 2026 18:28
…vs /MTd

Co-authored-by: LoveDoLove <67772009+LoveDoLove@users.noreply.github.com>
Copilot AI changed the title Add SysExec: lightweight C++ NT AUTHORITY\SYSTEM / remote command executor Fix MSVC Debug build: scope optimization flags to non-Debug configs only Mar 15, 2026
…fines

Co-authored-by: LoveDoLove <67772009+LoveDoLove@users.noreply.github.com>
Copilot AI changed the title Fix MSVC Debug build: scope optimization flags to non-Debug configs only Fix MSVC build errors: _countof undefined and duplicate macro redefinition Mar 15, 2026
Copilot stopped work on behalf of LoveDoLove due to an error March 15, 2026 07:18
@LoveDoLove LoveDoLove closed this Mar 15, 2026
@LoveDoLove LoveDoLove deleted the copilot/create-remote-command-tools branch March 15, 2026 07:24
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