I don't know how to resolve this.
Code:[localhost@localhost Code]$ gcc -static -O2 -o out c.c /usr/bin/ld: cannot find -lc collect2: error: ld returned 1 exit status [localhost@localhost Code]$
I don't know how to resolve this.
Code:[localhost@localhost Code]$ gcc -static -O2 -o out c.c /usr/bin/ld: cannot find -lc collect2: error: ld returned 1 exit status [localhost@localhost Code]$
Well the first thing to try is
gcc -v -static -O2 -o out c.c
This will show you all the command line options to all the compiler stages.
In particular, you need to look at all the -L/path/to/here options passed to collect2
Do all your compilations fail? or only those where the input file is called c.c?, or where you're passing -static as an option?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
It's only when I use the static option.
And what about following Salem's other suggestions?