mklink/Windows cmd for MinGW

本文介绍了如何使用Windows命令行工具mklink来创建文件和目录的符号链接。通过具体实例展示了mklink的基本语法及选项,包括创建普通符号链接、硬链接和目录连接,并演示了如何在MinGW环境下为gcc编译器创建符号链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

C:\WINDOWS\system32>mklink
The syntax of the command is incorrect.
Creates a symbolic link.

MKLINK [[/D] | [/H] | [/J]] Link Target

        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    Specifies the new symbolic link name.
        Target  Specifies the path (relative or absolute) that the new link
                refers to.

 

###Administrator privelege is needed 

C:\WINDOWS\system32>mklink    C:\MinGW\msys\1.0\bin\gcc.exe    C:\MinGW\bin\gcc.exe
symbolic link created for C:\MinGW\msys\1.0\bin\gcc.exe <<===>> C:\MinGW\bin\gcc.exe

C:\WINDOWS\system32>

 

C:\Users\jhula>dir     C:\MinGW\msys\1.0\bin\gcc.exe
 Volume in drive C is OSDisk
 Volume Serial Number is BA87-7956

 Directory of C:\MinGW\msys\1.0\bin

2019/07/19  10:38    <SYMLINK>      gcc.exe [C:\MinGW\bin\gcc.exe]
               1 File(s)              0 bytes
               0 Dir(s)  28,044,410,880 bytes free

C:\Users\jhula>

 

###MinGW 

lake@localhost /usr/bin
$ which gcc
/usr/bin/./gcc.exe

lake@localhost /usr/bin
$ gcc -version
gcc.exe: error: unrecognized command line option '-version'
gcc.exe: fatal error: no input files
compilation terminated.

"D:\Sketchpad5.06\Sketchpad5\Evoker12345\Creation\c-c++\JetBrains CLion\CLion 2020.3.4\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" D:\\编辑\C++\时间显示\工作区0 -- The C compiler identification is GNU 8.1.0 -- The CXX compiler identification is GNU 8.1.0 -- Check for working C compiler: D:/Sketchpad5.06/Sketchpad5/Evoker12345/Creation/c-c++/MinGW/mingw-18.0/MinGW/bin/gcc.exe -- Check for working C compiler: D:/Sketchpad5.06/Sketchpad5/Evoker12345/Creation/c-c++/MinGW/mingw-18.0/MinGW/bin/gcc.exe - broken CMake Error at D:/Sketchpad5.06/Sketchpad5/Evoker12345/Creation/c-c++/JetBrains CLion/CLion 2020.3.4/bin/cmake/win/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message): The C compiler "D:/Sketchpad5.06/Sketchpad5/Evoker12345/Creation/c-c++/MinGW/mingw-18.0/MinGW/bin/gcc.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: D:/顏涱亼顏旑伋顏旑伨/缂栬緫/C++/鏃堕棿鏄剧ず/宸ヤ綔鍖�0/cmake-build-debug/CMakeFiles/CMakeTmp Run Build Command(s):D:/Sketchpad5.06/Sketchpad5/Evoker12345/Creation/c-c++/MinGW/mingw-18.0/MinGW/bin/mingw32-make.exe cmTC_37cc5/fast && D:/Sketchpad5.06/Sketchpad5/Evoker12345/Creation/c-c++/MinGW/mingw-18.0/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_37cc5.dir\build.make CMakeFiles/cmTC_37cc5.dir/build mingw32-make.exe[1]: Entering directory 'D:/顏涱亼顏旑伋顏旑伨/缂栬緫/C++/鏃堕棿鏄剧ず/宸ヤ綔鍖�0/cmake-build-debug/CMakeFiles/CMakeTmp' Building C object CMakeFiles/cmTC_37cc5.dir/testCCompiler.c.obj D:\Sketchpad5.06\Sketchpad5\Evoker12345\Creation\c-c++\MinGW\mingw-18.0\MinGW\bin\gcc.exe -o CMakeFiles\cmTC_37cc5.dir\testCCompiler.c.obj -c D:\椤忔侗浜奸鏃戜紜椤忔棏浼╘缂傛牞绶玕C++\閺冨爼妫块弰鍓с仛\瀹搞儰缍旈崠?\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c gcc.exe: error: D:\椤忔侗浜奸鏃戜紜椤忔棏浼╘缂傛牞绶玕C++\閺冨爼妫块弰鍓с仛\瀹搞儰缍旈崠?\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory gcc.exe: fatal error: no input files compilation terminated. mingw32-make.exe[1]: *** [CMakeFiles\cmTC_37cc5.dir\build.make:85: CMakeFiles/cmTC_37cc5.dir/testCCompiler.c.obj] Error 1 mingw32-make.exe[1]: Leaving directory 'D:/顏涱亼顏旑伋顏旑伨/缂栬緫/C++/鏃堕棿鏄剧ず/宸ヤ綔鍖�0/cmake-build-debug/CMakeFiles/CMakeTmp' mingw32-make.exe: *** [Makefile:140: cmTC_37cc5/fast] Error 2 CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:2 (project) -- Configuring incomplete, errors occurred! See also "D:/顏涱亼顏旑伋顏旑伨/缂栬緫/C++/鏃堕棿鏄剧ず/宸ヤ綔鍖�0/cmake-build-debug/CMakeFiles/CMakeOutput.log". See also "D:/顏涱亼顏旑伋顏旑伨/缂栬緫/C++/鏃堕棿鏄剧ず/宸ヤ綔鍖�0/cmake-build-debug/CMakeFiles/CMakeError.log". [Finished]帮我诊断一下,谢谢!
06-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值