Share via

Windows 10 mklink error: "device does not support symbolic links" only for .hpp files during CMake build

Farid Omar 0 Reputation points
2026-06-02T04:05:01.41+00:00

I try to compile a ROS2 project on my work PC (Windows 10, version 22H2 build 19045.4651). During the build process, it completely stops. CMake shows an error because it cannot generate a symbolic link for the ping_node.hpp file. I opened my command prompt to test the mklink tool manually, and I found a very strange bug. When I try to make a link that ends with .hpp, Windows blocks it and says: "The device does not support symbolic links." But if I point to the exact same target and just name the link .exe, it succeeds perfectly! Why does my OS block symlinks only for .hpp extensions? I cannot create the links manually before compiling because the build script always clears the destination folder first. Do you have any solutions for this strange filesystem rule? Thank you.

Windows for business | Windows 365 Business
0 comments No comments

1 answer

Sort by: Most helpful
  1. Harry Phan 22,230 Reputation points Independent Advisor
    2026-06-02T04:33:53.8+00:00

    Hi Farid,

    Windows does not block symbolic links based on file extensions. The error you’re seeing with .hpp is not an intentional filesystem rule, but rather a side effect of how symlink creation is being attempted. On Windows 10, symbolic links require either Developer Mode enabled or elevated privileges; otherwise, mklink falls back to creating junctions, which only work for directories. When you tested with .exe, it succeeded because Windows treated it differently in that context, but there is no documented restriction against .hpp.

    The reliable fix is to enable Developer Mode in Windows Settings → Update & Security → For Developers, which allows symlinks without admin rights. Alternatively, run your build in an elevated command prompt so mklink can create proper file symlinks regardless of extension. For ROS2 builds on Windows, this is a known requirement: CMake and colcon rely on symlink support, and without Developer Mode or admin rights, file links fail. In short, this is not a .hpp rule, but a permissions/configuration issue. You should enable Developer Mode or run the build as Administrator to resolve it.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.