PDA

View Full Version : [ubuntu] /usr/bin/ld: 1: Syntax error: newline unexpected. Need immediatel help



biky2004indra
December 24th, 2008, 05:31 AM
Hi,
I am in a big problem. Please help me. my problem is that when i am trying to compile any c/c++ program using the command g++ -lm sample.c -o sample, where sample.c is my c program name, the the following error message is giving : /usr/bin/ld: 1: Syntax error: newline unexpected
collect2: ld returned 2 exit status
I am using UBUNTU 8.10 and it was updated regularly. I have tried in various way to debug, but no one is working. How can i solve it. someone suggested to uninstall everything and reinstall again. i have already uninstalled g++ and gcc & then reinstalled again. but no positive result. can anyone tell me how can i solve it without formatting the ubuntu.
Thanks and waiting.

ezren
May 23rd, 2009, 04:55 AM
I am having the same issue with Ubuntu 9.04. Does anyone have any leads on this issue? I'd really hate to have to reinstall my whole system. It seems I am unable to install any new software now... I'm pretty new at Linux so forgive my ignorance ahead of time please.

Thanks

westyfresh
February 27th, 2011, 09:36 AM
Did you find a solution? I am getting the same error. I checked google and did not find the error.




/usr/bin/ld: 1: Syntax error: newline unexpected
collect2: ld returned 2 exit status

ankitanand
June 10th, 2011, 08:48 AM
/usr/bin/ld is a gnu linker program, available in binutils package. Reinstalling binutils will solve this problem

Run following command

sudo apt-get autoremove binutils

sudo apt-get install binutils