差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

Both sides previous revision 前次修改
下次修改
前次修改
gcc [2017/11/05 02:30]
jz
gcc [2017/11/12 23:02] (目前版本)
jz
行 1: 行 1:
 ====== GCC ====== ====== GCC ======
 +
 +===== Compile =====
 +<code bash>
 +g++ mylib1.cpp
 +g++ mylib2.cpp
 +
 +# shared
 +g++ -shared -fPIC -o libmylib.so mylib1.o mylib2.o
 +g++ -o main main.cpp libmylib.so
 +LD_LIBRARY_PATH=. ./main
 +
 +# static
 +ar rcs libmylib.a mylib1.o mylib2.o
 +g++ -o main main.cpp -L. lmylib
 +./main
 +
 +# prevents linking with the shared libraries
 +g++ -static -o main main.cpp -L. lmylib
 +</​code>​
  
 ===== Distinguish An ELF Binary is Hard-float or Soft-float ===== ===== Distinguish An ELF Binary is Hard-float or Soft-float =====
行 22: 行 41:
  
 [[https://​www.linaro.org/​downloads/​]] [[https://​www.linaro.org/​downloads/​]]
 +
 +
 +**Ref**
 +  * http://​codingstandards.iteye.com/​blog/​1142358
 +  * https://​www.ptt.cc/​bbs/​LinuxDev/​M.1162669989.A.2E6.html