当前位置:网站首页>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
边栏推荐
- 针对语义分割的真实世界的对抗样本攻击
- Open3d learning note 5 [rgbd fusion]
- 稀疏矩阵存储
- VS Code配置问题
- 将恶意软件嵌入到神经网络中
- Global and Chinese market of tillage finishing machines 2022-2028: Research Report on technology, participants, trends, market size and share
- Global and Chinese markets for Salmonella typhi nucleic acid detection kits 2022-2028: Research Report on technology, participants, trends, market size and share
- 多站点高可用部署
- Matlab数学建模工具
- Erase method in string
猜你喜欢

EKLAVYA -- 利用神经网络推断二进制文件中函数的参数
![Open3d learning note 3 [sampling and voxelization]](/img/71/0b2ac5dfd538017de639e5651c7f46.png)
Open3d learning note 3 [sampling and voxelization]

On November 24, we celebrate the "full moon"

OpenCV3 6.3 用滤波器进行缩减像素采样

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

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

【MobileNet V3】《Searching for MobileNetV3》

针对tqdm和print的顺序问题

Graph Pooling 简析

What if the laptop can't search the wireless network signal
随机推荐
Daily practice (19): print binary tree from top to bottom
业务架构图
Summary of open3d environment errors
【Mixed Pooling】《Mixed Pooling for Convolutional Neural Networks》
On the confrontation samples and their generation methods in deep learning
STL速查手册
install. IMG production method
利用Transformer来进行目标检测和语义分割
简易打包工具的安装与使用
将恶意软件嵌入到神经网络中
Wang extracurricular words
On the back door of deep learning model
OpenCV3 6.2 低通滤波器的使用
【MagNet】《Progressive Semantic Segmentation》
open3d学习笔记三【采样与体素化】
使用C#语言来进行json串的接收
Replace convolution with full connection layer -- repmlp
EKLAVYA -- 利用神经网络推断二进制文件中函数的参数
王-课外单词
高中数学必修一