-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmkf3.html
More file actions
39 lines (37 loc) · 6.05 KB
/
Copy pathmkf3.html
File metadata and controls
39 lines (37 loc) · 6.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<html><head><meta charset="utf-8" /><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/shuzijun/[email protected]/src/main/resources/vditor/dist/index.css"/><script src="https://cdn.jsdelivr.net/gh/shuzijun/[email protected]/src/main/resources/vditor/dist/js/i18n/zh_CN.js"></script><script src="https://cdn.jsdelivr.net/gh/shuzijun/[email protected]/src/main/resources/vditor/dist/method.min.js"></script></head><body style="width: 1075px;"><div class="vditor-reset" id="preview"><h2 id="一个实例"><em><em>一个实例</em></em><a id="vditorAnchor-一个实例" class="vditor-anchor" href="#一个实例"><svg viewBox="0 0 16 16" version="1.1" width="16" height="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a></h2>
<pre><code>先看文件结构
Dirname
--add.cpp
--add.h
--mult.cpp
--mult.h
calc.cpp
</code></pre>
<h2 id="再看使用make编译的命令">再看使用make编译的命令<a id="vditorAnchor-再看使用make编译的命令" class="vditor-anchor" href="#再看使用make编译的命令"><svg viewBox="0 0 16 16" version="1.1" width="16" height="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a></h2>
<pre><code>calc :
gcc add.cpp mult.cpp calc.cpp -o calc.exe
</code></pre>
<h4 id="虽然这样编译是对的-但是还是有美中不足--这样不好-下面命令更有优点---当更换源代码再次编译的时候-会更快的编译">虽然这样编译是对的,但是还是有美中不足——这样不好,下面命令更有优点 : 当更换源代码再次编译的时候,会更快的编译<a id="vditorAnchor-虽然这样编译是对的-但是还是有美中不足--这样不好-下面命令更有优点---当更换源代码再次编译的时候-会更快的编译" class="vditor-anchor" href="#虽然这样编译是对的-但是还是有美中不足--这样不好-下面命令更有优点---当更换源代码再次编译的时候-会更快的编译"><svg viewBox="0 0 16 16" version="1.1" width="16" height="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a></h4>
<pre><code>calc : mult.o add.o
g++ -c add.o mult.o calc.cpp -o calcNew.exe
add.o : add.cpp
g++ -c add.cpp -o add.o
mult.o : mult.cpp
g++ -c mult.cpp -o mult.o
</code></pre>
<h2 id="编译流程拆分-g---main-cpp---o-main-exe-或者g----lstdc---main-cpp---o-main-exe--"><em><em>编译流程拆分(<u>g++ main.cpp (-o main.exe)</u>或者<u>g++ -lstdc++ main.cpp (-o main.exe)</u>)</em></em><a id="vditorAnchor-编译流程拆分-g---main-cpp---o-main-exe-或者g----lstdc---main-cpp---o-main-exe--" class="vditor-anchor" href="#编译流程拆分-g---main-cpp---o-main-exe-或者g----lstdc---main-cpp---o-main-exe--"><svg viewBox="0 0 16 16" version="1.1" width="16" height="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a></h2>
<blockquote>
<blockquote>
<p>预处理 : gcc -E main.cpp >main.ii(预处理文件)</p>
</blockquote>
<blockquote>
<p>编译 : gcc -S main.ii(汇编文件)</p>
</blockquote>
<blockquote>
<p>汇编 : gcc -c main.s(二进制文件)</p>
</blockquote>
<blockquote>
<p>链接 : g++ -lstdc++ main.o(生成可执行文件,我写的c++,所以用的g++,c语言用gcc)</p>
</blockquote>
</blockquote>
</div><script> const previewElement = document.getElementById('preview'); Vditor.setContentTheme('idea-light', 'https://cdn.jsdelivr.net/gh/shuzijun/[email protected]/src/main/resources/vditor/dist/css/content-theme'); Vditor.codeRender(previewElement); Vditor.highlightRender({"enable":true,"lineNumber":false,"style":"dracula"}, previewElement, 'https://cdn.jsdelivr.net/gh/shuzijun/[email protected]/src/main/resources/vditor'); Vditor.mathRender(previewElement, { cdn: 'https://cdn.jsdelivr.net/gh/shuzijun/[email protected]/src/main/resources/vditor',math: {"engine":"KaTeX","inlineDigit":true,"macros":{}}}); Vditor.mermaidRender(previewElement, 'https://cdn.jsdelivr.net/gh/shuzijun/[email protected]/src/main/resources/vditor', 'light'); Vditor.flowchartRender(previewElement, 'https://cdn.jsdelivr.net/gh/shuzijun/[email protected]/src/main/resources/vditor'); Vditor.graphvizRender(previewElement, 'https://cdn.jsdelivr.net/gh/shuzijun/[email protected]/src/main/resources/vditor'); Vditor.chartRender(previewElement, 'https://cdn.jsdelivr.net/gh/shuzijun/[email protected]/src/main/resources/vditor', 'light'); Vditor.mindmapRender(previewElement, 'https://cdn.jsdelivr.net/gh/shuzijun/[email protected]/src/main/resources/vditor', 'light'); Vditor.abcRender(previewElement, 'https://cdn.jsdelivr.net/gh/shuzijun/[email protected]/src/main/resources/vditor'); Vditor.mediaRender(previewElement); Vditor.speechRender(previewElement); </script> <script src="https://cdn.jsdelivr.net/gh/shuzijun/[email protected]/src/main/resources/vditor/dist/js/icons/ant.js"></script></body></html>