1. g++ hello.c -fPIC -c -o hello.o //-c只编译(生成中间同名目标文件,不链接)-o指定输出文件名,该文件为可执行文件,不加-o会默认生成.out
2. g++ hello.o -shared -o libmyhello.so
gcc -fPIC -shared -o libNAME.so file1.c file2.c
g++ hello.c -c 编译生成hello.out文件
g++ hello.c -o hello 生成可执行文件hello
-g 表示生成的文件是可调试的,如果没有-g,调试时无法命中断点