语法高亮,滚动条美化,设置页面调整

This commit is contained in:
fofolee
2019-04-19 02:41:09 +08:00
parent 1e8f76c000
commit 359d29ee0b
1590 changed files with 12328 additions and 11441 deletions

View File

@@ -3,9 +3,9 @@
<h2 id="补充说明">补充说明</h2>
<p><strong>gcc命令</strong> 使用GNU推出的基于C/C++的编译器是开放源代码领域应用最广泛的编译器具有功能强大编译代码支持性能优化等特点。现在很多程序员都应用GCC怎样才能更好的应用GCC。目前GCC可以用来编译C/C++、FORTRAN、JAVA、OBJC、ADA等语言的程序可根据需要选择安装支持的语言。</p>
<h3 id="语法">语法</h3>
<pre><code>gcc(选项)(参数)</code></pre>
<pre><code class="language-bash">gcc(选项)(参数)</code></pre>
<h3 id="选项">选项</h3>
<pre><code>-o指定生成的输出文件
<pre><code class="language-bash">-o指定生成的输出文件
-E仅执行编译预处理
-S将C代码转换为汇编代码
-wall显示警告信息
@@ -16,34 +16,34 @@
<p><strong>常用编译命令选项</strong></p>
<p>假设源程序文件名为test.c</p>
<p><strong>无选项编译链接</strong></p>
<pre><code>gcc test.c</code></pre>
<pre><code class="language-bash">gcc test.c</code></pre>
<p>将test.c预处理、汇编、编译并链接形成可执行文件。这里未指定输出文件默认输出为a.out。</p>
<p><strong>选项 -o</strong></p>
<pre><code>gcc test.c -o test</code></pre>
<pre><code class="language-bash">gcc test.c -o test</code></pre>
<p>将test.c预处理、汇编、编译并链接形成可执行文件test。-o选项用来指定输出文件的文件名。</p>
<p><strong>选项 -E</strong></p>
<pre><code>gcc -E test.c -o test.i</code></pre>
<pre><code class="language-bash">gcc -E test.c -o test.i</code></pre>
<p>将test.c预处理输出test.i文件。</p>
<p><strong>选项 -S</strong></p>
<pre><code>gcc -S test.i</code></pre>
<pre><code class="language-bash">gcc -S test.i</code></pre>
<p>将预处理输出文件test.i汇编成test.s文件。</p>
<p><strong>选项 -c</strong></p>
<pre><code>gcc -c test.s</code></pre>
<pre><code class="language-bash">gcc -c test.s</code></pre>
<p>将汇编输出文件test.s编译输出test.o文件。</p>
<p><strong>无选项链接</strong></p>
<pre><code>gcc test.o -o test</code></pre>
<pre><code class="language-bash">gcc test.o -o test</code></pre>
<p>将编译输出文件test.o链接成最终可执行文件test。</p>
<p><strong>选项 -O</strong></p>
<pre><code>gcc -O1 test.c -o test</code></pre>
<pre><code class="language-bash">gcc -O1 test.c -o test</code></pre>
<p>使用编译优化级别1编译程序。级别为1~3级别越大优化效果越好但编译时间越长。</p>
<p><strong>多源文件的编译方法</strong></p>
<p>如果有多个源文件,基本上有两种编译方法:</p>
<p>假设有两个源文件为test.c和testfun.c</p>
<p><strong>多个文件一起编译</strong></p>
<pre><code>gcc testfun.c test.c -o test</code></pre>
<pre><code class="language-bash">gcc testfun.c test.c -o test</code></pre>
<p>将testfun.c和test.c分别编译后链接成test可执行文件。</p>
<p><strong>分别编译各个源文件,之后对编译后输出的目标文件链接。</strong></p>
<pre><code>gcc -c testfun.c #将testfun.c编译成testfun.o
<pre><code class="language-bash">gcc -c testfun.c #将testfun.c编译成testfun.o
gcc -c test.c #将test.c编译成test.o
gcc -o testfun.o test.o -o test #将testfun.o和test.o链接成test</code></pre>
<p>以上两种方法相比较,第一中方法编译时需要所有文件重新编译,而第二种方法可以只重新编译修改的文件,未修改的文件不用重新编译。</p>