Vir*_*ava 7 c++ installation mingw compiler-errors msys2
要启动代码和编译 C++,必须安装编译器。就我而言,它是MSYS2,通过它可以使用MinGW 。根据网站上提到的安装向导,我安装了该软件,没有任何错误。现在我应该通过输入来更新包数据库和基础包pacman -Sys,但它显示了一个错误
error: failed to synchronize all databases (unable to lock database)
在网上搜索解决方案后,我发现删除/删除将db.lck起作用,为此,我使用了此命令,rm /var/lib/pacman/db.lck
但它显示了另一个错误。目前网上还没有解决这个问题的方法。我还粘贴了MSYS2 MSYS的终端输出以供参考。
$ pacman -Sys
:: Synchronizing package databases...
error: failed to synchronize all databases (unable to lock database)
VIRAT@DESKTOP-97BS0AB MSYS ~
$ rm /var/lib/pacman/db.lck
rm: cannot remove '/var/lib/pacman/db.lck': No such file or directory
VIRAT@DESKTOP-97BS0AB MSYS ~
$ pacman -S --needed base-devel mingw-w64-x86_64-toolchain
error: failed to init transaction (unable to lock database)
error: could not lock database: Permission denied
VIRAT@DESKTOP-97BS0AB MSYS ~
$ pacman -Su
error: failed to init transaction (unable to lock database)
error: could not lock database: Permission denied
VIRAT@DESKTOP-97BS0AB MSYS ~
$
Run Code Online (Sandbox Code Playgroud)
我发现这个错误有两种解决方案。尝试两者:
解决方案:1
C:\Users\your_account_name\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\MSYS2 64bit
以管理员身份运行“MSYS2 MSYS”
运行命令:pacman -Syu
解决方案 - 2:
C:\msys64\var\lib\pacman (转到下载的文件夹)
删除“db.lck”文件
资源 :
对于解决方案 1:Padro 先生(/sf/users/1323742941/)的解决方案帮助了我。
对于解决方案2 https://www.reddit.com/r/archlinux/comments/nvrny2/pacman_error_failed_to_synchronize_all_databases/