简体   繁体   English

g++ 权限被拒绝(Mac)

[英]g++ permission denied(Mac)

I tried to run a c++ file with the mac terminal, but it gave me the error as shown below:我尝试用 mac 终端运行 c++ 文件,但它给了我如下所示的错误:

在此处输入图像描述

Does anyone have any idea why this is happening?有谁知道为什么会这样?

If you do this gcc test.cpp you will get executable called a.out , and to run it you type:如果你这样做gcc test.cpp你会得到一个名为a.out的可执行文件,运行它你输入:

./a.out

to get executable called test you have to run g++ test.cpp -o test now you can run this:要获得名为test的可执行文件,您必须运行g++ test.cpp -o test现在您可以运行以下命令:

./test

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM