Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

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

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.


First installed gcc manually, had the problem, then uninstalled and installed it with homebrew and still have the problem. How can I fix this?



(Have the 5.1.0 version of gcc)

MacBook Pro (13-inch Mid 2012)

Posted on Sep 26, 2016 9:35 PM

Reply
Question marked as Top-ranking reply

Posted on Sep 27, 2016 8:58 PM

Ok so no one answered but I found a solution. It's the version of gcc, apparently newer versions have that bug, the one that works and compiles the codes is the 4.9 version, in case it's useful to someone.

1 reply
Sort By: 

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

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.