A.K.M. Adib
A.K.M. Adib

Reputation: 567

C++ build failing on MacOS

I'm trying to run my C++ program on my Macbook and I'm trying to run my program in VSCode by running the build task C/C++:clang++ build active file. However, every time I do this I get this error ld: can't open output file for writing: /Users/admin/first/first, errno=21 for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) The terminal process terminated with exit code: 1

Upvotes: 0

Views: 321

Answers (2)

Ray Johns
Ray Johns

Reputation: 808

Did you brew install any c++ tools? Sometimes that is the source of these issues. The program is trying to use native OS versions of things when it should use Homebrew's or vice versa.

Upvotes: 0

Adrien Leravat
Adrien Leravat

Reputation: 2789

This appears to be a simple permission problem here:

ld: can't open output file for writing

The linker cannot write to the file specified.

Edit: As correctly pointed to by molbdnilo, the error 21 is EISDIR, which means the file you are trying to write to already exists as a directory. So ... just this folder? :)

Upvotes: 2

Related Questions