g++/gcc编译链接遇到Syntax error: newline unexpected 怎么解决?

在Ubuntu系统,用C++封装Eigen库,编译成静态库可以通过,但是在链接过程中提示如下错误;如果直接编译成动态库,则直接报如下错误;
错误提示:
/usr/bin/ld: 2: Syntax error: newline unexpected
collect2: error: ld returned 2 exit status

你好同学,可以看看前人的经验:
具体错误:
/usr/bin/ld: 1: Syntax error: newline unexpected
collect2: ld returned 2 exit status
解决方法:
/usr/bin/ld是一个GNU链接程序,可在BIUTILS包中使用。重新安装BIUTILS将解决这个问题,按以下命令运行:

sudo apt-get autoremove binutils
sudo apt-get install binutils

这样就解决这个问题