Skip to content

Avoid transitive includes#14483

Merged
OhadMeir merged 1 commit into
realsenseai:migrationfrom
brianferri:development
Dec 2, 2025
Merged

Avoid transitive includes#14483
OhadMeir merged 1 commit into
realsenseai:migrationfrom
brianferri:development

Conversation

@brianferri

Copy link
Copy Markdown
Contributor

I've been trying to wrap the SDK for Zig and I found that, while compiling for Linux x86_64 the compilation would fail due to undefined templates/incompatible binary operators being used in src/linux/backend-hid.h and third-party/rsutils/src/network-adapter-watcher.cpp:

  • librealsense/src/linux/backend-hid.h uses std::fstream and std::ifstream without including <fstream>
  • librealsense/third-party/rsutils/src/network-adapter-watcher.cpp uses std::thread without including <thread>

Both files rely on transitive includes that may not be available across different build environments, causing compilation failures when the header dependency chain changes.

I haven't dug enough around to see if there are other places where this happens, I hope this PR brings the underlying issue to the attention of the core developers and encourages a more thorough audit of the codebase for similar missing includes.

Fix missing <fstream> include in backend-hid.h and <thread> include in
network-adapter-watcher.cpp to ensure proper compilation across
different build environments and avoid implicit dependency on transitive
includes.
@Nir-Az Nir-Az requested a review from OhadMeir December 1, 2025 21:40
@Nir-Az Nir-Az changed the base branch from development to migration December 1, 2025 21:41

@OhadMeir OhadMeir left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @brianferri for your contribution.
I have opened an internal ticket to handle other cases of such missing includes.

@OhadMeir OhadMeir merged commit cbb3f7c into realsenseai:migration Dec 2, 2025
25 checks passed
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