首次执行时无法运行已编译的C ++程序 [英] Unable to run compiled C++ programs on first execution

查看:63
本文介绍了首次执行时无法运行已编译的C ++程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从升级到Mac OS Catalina以来,每次我编译C ++程序时,它都不会第一次运行.该程序将按预期编译,并创建可执行文件,并且在所有方面均看起来正常.但是,当我运行该程序时,它会立即打印:

Ever since upgrading to Mac OS Catalina, any time I compile a C++ program, it does not run the first time. The program compiles as expected and the executable is created and appears normal in all regards. However, when I run the program it immediately prints:

-bash:./a.out:输入/输出错误

-bash: ./a.out: Input/output error

立即再次运行该程序可以完全按预期工作.下面是该流程和用于生成错误的简单程序的屏幕截图.

Immediately running the program again works exactly as expected. Below is a screenshot of the flow and the simple program used to generate the errors.

#include <iostream>

int main ()
{
    std::cout << "test\n";
    return 0;
}

推荐答案

经过几天的挖掘,我能够解决此问题.问题是我的组织使用了Cylance和高级威胁缓解工具.在Catalina升级后,Cylance在系统偏好设置的安全设置下丢失了 Full Disk Access .我授予了权限,并能够获得解决该问题的更新策略.

After days of digging, I was able to resolve the issue. The problem was that my organization uses Cylance, and advanced threat mitigation tool. After Catalina upgrade, Cylance lost its Full Disk Access under the security settings in system preferences. I granted the permissions and was able to get an updated policy that fixed the problem.

我已经运行了 sudo dmesg 并注意到了这一行:

I had run sudo dmesg and noticed the line:

hook_thread_userret称为CyProtectDrv.MemDef错误

hook_thread_userret calledCyProtectDrv.MemDef ERROR

这似乎是一个潜在的问题.我搜索了该字符串,发现第一个结果与Cylance有关.这就是导致我沿着非常具体的解决方案道路前进的原因.我希望这可以为其他人节省很多时间.

which seemed like a potential issue. I searched for that string and saw that the first result was Cylance related. That is what led me down this very specific path to a solution. I hope this saves someone else a bunch of hours.

这篇关于首次执行时无法运行已编译的C ++程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆