当前位置:网站首页>G++ compilation command use
G++ compilation command use
2022-06-23 07:22:00 【Monkey king who can write code】
g++ main.cpp Compile the file , Generate an executable program , The default name is
g++ main.cpp -o main Compile the file , Generate an executable program , The name is main
g++ main.cpp -I include/ -I Specify the header directory
g++ main.cpp -l xxx -l Parameter specifies the static library name (linux The name of the next static library is libxxx.a windows Next is xxx.lib)
C++ The specific steps from the source file to the executable program are :
Preprocessing compile assembly link
We can use the command to generate the results of a certain step processing separately
Preprocessing -E The essence is the processing of text , Replacement of macro definitions 、 Copy the header file to the corresponding location 、 Delete Note
compile -S Text compiled into assembly code
assembly -o Assembly code into executable instructions
link Static library 、 Dynamic library Links
g++ -E hello.cpp -o hello.i Get the preprocessed file hello.i
g++ -S hello.i Get the compiled assembly file hello.s This name is the default
g++ -c hello.s Get the compiled file hello.o
g++ hello.o -o hello The single file link here is hello Sure ./hello perform
Static library production
g++ -c add.cpp print.cpp Generate .o file
ar rcs libtest.a add.o print.o Generate static libraries libtest.a
g++ main.cpp -l test Pay attention to the functions in the library 、 Declaration of a class
Dynamic library production
边栏推荐
- C # how to obtain DPI and real resolution (can solve the problem that has been 96)
- 313. 超级丑数
- 407 stack and queue (232. implementing queue with stack, 225. implementing stack with queue)
- Spock constraint - call frequency / target / method parameters
- deeplab v3 代码结构图
- 406-双指针(27. 移除元素、977.有序数组的平方、15. 三数之和、18. 四数之和)
- Specific help of OSI layered model to work
- 滚动播报效果的实现
- MySQL(五) — 锁及事务
- 309. the best time to buy and sell stocks includes the freezing period
猜你喜欢
![Don't look for [12 super easy-to-use Google plug-ins are here] (are you sure you want to take a look?)](/img/45/3e43faf7aba6741825ccb9719b8445.png)
Don't look for [12 super easy-to-use Google plug-ins are here] (are you sure you want to take a look?)

GINet

Analyzing the creation principle in maker Education

Analysis of personalized learning progress in maker Education

PSP code implementation

【***数组***】

Interpreting the spirit of unity and cooperation in maker Education

How flannel works

SSTable详解

Quartz调度框架的学习使用
随机推荐
SSM整合
900. RLE iterator
C DPI adaptation problem
Ldconfig command
MySQL(二) — MySQL数据类型
正则表达式图文超详细总结不用死记硬背(上篇)
【2022毕业季】从毕业到转入职场
deeplab v3 代码结构图
MySQL mvcc multi version concurrency control
MySQL transaction isolation level
如何达到高效的网络信息传播
对二进制的某一位操作
小爱音箱连接网络异常解决办法
深度学习系列46:人脸图像超分GFP-GAN
In depth learning series 47:stylegan summary
20220620 uniformly completely observable (UCO)
'Latin-1' codec can't encode characters in position 103-115: body ('string of Chinese ') is not valid Latin-1
GINet
g++编译命令使用
306. Addenda