M.O.
M.O.

Reputation: 496

C error: ld: library not found for -lgcc Collect2: error

I am trying to compile the basic "Hello World" C code with gcc but the following error appears:

ld: library not found for -lgcc
collect2: error: ld returned 1 exit status

The code itself it's fine, ran it in another computer without any problems.

Here there's a picture of how the terminal looks like. I am not sure if I missed something when downloading gcc or something.

I am on Yosemite if it's of any importance and have the 5.1.0 version of gcc.

Upvotes: 2

Views: 2444

Answers (1)

M.O.
M.O.

Reputation: 496

It was just an incompatibility of the compiler with Yosemite I think. Have to compile with gcc4.9 and it works just fine.

You compile with gcc4.9 this way

gcc-4.9 -o output file.c

Upvotes: 1

Related Questions