G ++ compiler cannot create a.out file?

So, I did the homework for my C ++ class. I compiled quite a long time with this statement g++-5.2.0 -std=c++14 -Wall -Wextra -pedantic <file_name>in the terminal when, for some reason, I got this message unbeknownst to me: Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo..

Naively, I executed the command sudo g++-5.2.0 -std=c++14 -Wall -Wextra -pedantic hw2pr3.cpp, entered it in my password and agreed to the terms.

Now, when I try to compile with g++-5.2.0 -std=c++14 -Wall -Wextra -pedantic hw2pr3.cpp, I get the following statement:

ld: can't write output file: a.out for architecture x86_64 collect2: error: ld returned 1 exit status

Does anyone know what to do with this?

What distinguishes the file I'm trying to run now (hw2pr3.cpp) than the previous files:

std::cout << std::setprecision(2) << "You should give away about $" << donate << ", save about $" << save <<", and live on about $" << live << ".\n";

I assume either std :: set precision (2) messed up this (this is my first time using this operator and I don't know if I did it right) or that the '$' in cout is causing problems.

, ; , .

+4
1

sudo g++-5.2.0, root, a.out root. sudo a.out. , / a.out.

sudo rm a.out .

+3

Source: https://habr.com/ru/post/1608099/


All Articles