Tuesday 15 September 2015

c++ - Why would clang++ fail to compile on a Mac, under Mavericks, except with sudo? -



c++ - Why would clang++ fail to compile on a Mac, under Mavericks, except with sudo? -

after recent software update on mac, i'm not able compile , link c++ hello world programme without sudo.

the programme (helloworld.cpp):

#include <iostream> int main(){ std::cout << "hello world\n"; homecoming 0; }

the invocation:

clang++ helloworld.cpp

fails error:

ld: can't write output file: a.out architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation)

but if under sudo,

sudo clang++ helloworld.cpp

there's no problem.

what might causing this, , how might able resolve this?

edit, again: reply turned out not working directory permissions, couple of people suggested, permissions associated output file, a.out, of hello world program. credit petesh solution.

you must sitting in directory not writable user. @ pwd , ls -ld . see , permissions there. seek creating empty file touch foo.txt in same directory ran clang.

c++ osx clang xcode6

No comments:

Post a Comment