错误如下:

/usr/bin/ld: /tmp/cc317wRL.o: undefined reference to symbol 'dlsym@@GLIBC_2.17'
/usr/lib/gcc/aarch64-linux-gnu/5/../../../aarch64-linux-gnu/libdl.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

解决办法:

  • 加 -ldl
  • 要放在所有的-I之后。