After the last software update on my mac, I can not compile and link the global C ++ hello program without sudo.
Program (helloworld.cpp):
#include <iostream> int main(){ std::cout << "hello world\n"; return 0; }
Call:
clang++ helloworld.cpp
Error with error:
ld: cannot write output file: a.out for x86_64 architecture clang: error: linker command did not work with exit code 1 (use -v to call the call)
But if I do it under sudo,
sudo clang++ helloworld.cpp
No problems.
What could be the reason for this and how can I resolve this?
EDIT, again . The answer was not to work with directory permissions, as suggested by several people, but permissions related to the output file, a.out, of my worldwide hello program, Thank Petesh for the solution.
source share