ulivz / cpp Goto Github PK
View Code? Open in Web Editor NEWCode collection of my cpp learning process.
Code collection of my cpp learning process.
首先,回顾一下程序编译的过程:
首先,我们按照常规逻辑新建一个 Clion 的 project,源码非常简单:
// main.cpp
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
Tip:请不要用 gcc 来打包 cpp 😅.
结合 g++ 来运行一下:
g++ -c
的作用是将源文件编译成汇编文件,在链接之前,该文件不是可执行文件;
g++ ./main.cpp -o main # 告诉编译器编译源代码但不要执行链接,输出结果为对象`(*.o)`文件
du -h ./main.o # 8.0K
接着,我们将上述两个源码文件 (main.cpp, main.o) 编译链接成一个单一的可执行程序:
g++ ./main.cpp -o main
du -h ./main.o # 16K
之所以成为【静态库】,是因为在链接阶段,会将汇编生成的目标文件.o与引用到的库一起链接打包到可执行文件中。因此对应的链接方式称为静态链接。
静态库的特点:
这好像可以理解成
UMD
😅
动态库特点总结:
这好像可以理解成
CommonJS 或者 esmodule
😅(尽管 esmodule 是静态的,但 node 将支持 esmodule,使其运行时才会被载入)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.