当前位置:网站首页>Static library and dynamic library
Static library and dynamic library
2022-07-02 08:07:00 【programmercherry】
Linux Under the system Three ways of program operation

Direct operation
g++ main.cpp src/swap.cpp -Iinclude -Wall -std=c++11 -o a.out
./a.out
Link static libraries to generate executables
// Get into src Under the table of contents
cd src
// assembly Generate swap.o file
g++ swap.cpp -c -I../include
// Generate static libraries libswap.a
ar rs libswap.a swap.o
// Go back to the parent directory
cd ..
// link Generate executable files static_main
g++ main.cpp -Iinclude -Lsrc -o static_main
// Run the executable
./static_main
Link dynamic library to generate executable file
// Get into src Under the table of contents
cd src
// Generate target file ,fPIC Create an address independent compiler (pic,position independent code), In order to be able to share among multiple applications .
g++ swap.cpp -I../include -c -fPIC
// Generate dynamic library libswap.so
g++ -shared -o libswap.so swap.o
// The above two steps can be combined into one command g++ swap.cpp -I../include -fPIC -shared -o libswap.so
// Go back to the parent directory
cd ..
// link Generate executable files dynamic_main
g++ main.cpp -Iinclude -Lsrc -lswap -o dynamic_main
// Run the executable
LD_LIBRARY_PATH=src ./dynamic_main
Excellent article : The difference between static library and dynamic library
边栏推荐
- OpenCV3 6.3 用滤波器进行缩减像素采样
- 服务器的内网可以访问,外网却不能访问的问题
- AR系统总结收获
- Organigramme des activités
- Several methods of image enhancement and matlab code
- 力扣方法总结:滑动窗口
- Rhel7 operation level introduction and switching operation
- Open3d learning note 4 [surface reconstruction]
- 解决jetson nano安装onnx错误(ERROR: Failed building wheel for onnx)总结
- install. IMG production method
猜你喜欢

利用Transformer来进行目标检测和语义分割

11月24号,我们为“满月”庆祝

Look for we media materials from four aspects to ensure your creative inspiration

How to back up the configuration before the idea when reinstalling the idea

将恶意软件嵌入到神经网络中

【MobileNet V3】《Searching for MobileNetV3》

open3d学习笔记三【采样与体素化】

浅谈深度学习模型中的后门

The internal network of the server can be accessed, but the external network cannot be accessed

【Batch】learning notes
随机推荐
open3d学习笔记四【表面重建】
w10升级至W11系统,黑屏但鼠标与桌面快捷方式能用,如何解决
Comparison between setTimeout and requestanimationframe (page refresh)
力扣方法总结:查找类
针对tqdm和print的顺序问题
使用C#语言来进行json串的接收
联邦学习下的数据逆向攻击 -- GradInversion
Using transformer for object detection and semantic segmentation
Brief introduction of prompt paradigm
业务架构图
Media query usage
OpenCV关于x,y坐标容易混淆的心得
Open3d learning note 4 [surface reconstruction]
【C#笔记】winform中保存DataGridView中的数据为Excel和CSV
Feature Engineering: summary of common feature transformation methods
【Batch】learning notes
Target detection for long tail distribution -- balanced group softmax
针对语义分割的真实世界的对抗样本攻击
Data reverse attack under federated learning -- gradinversion
Carla-UE4Editor导入RoadRunner地图文件(保姆级教程)