{"id":111620,"date":"2026-10-01T11:22:48","date_gmt":"2026-10-01T03:22:48","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/111620.html"},"modified":"2026-10-01T11:22:48","modified_gmt":"2026-10-01T03:22:48","slug":"%e7%bc%96%e8%af%91%e5%99%a8gcc","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/111620.html","title":{"rendered":"\u7f16\u8bd1\u5668gcc"},"content":{"rendered":"<h3>\u76ee\u5f55<\/h3>\n<ul>\n<li>1. \u4ece\u6e90\u7801\u5230\u53ef\u6267\u884c\u6587\u4ef6\u7684\u56db\u4e2a\u9636\u6bb5\n<ul>\n<li>1.1. \u9884\u5904\u7406<\/li>\n<li>1.2. \u7f16\u8bd1<\/li>\n<li>1.3. \u6c47\u7f16<\/li>\n<li>1.4. \u94fe\u63a5<\/li>\n<\/ul>\n<\/li>\n<li>2. \u9759\u6001\u5e93\u548c\u52a8\u6001\u5e93\n<ul>\n<li>2.1 \u4ec0\u4e48\u662f\u5e93&#xff1f;<\/li>\n<li>2.2 \u9759\u6001\u94fe\u63a5<\/li>\n<li>2.3 \u52a8\u6001\u94fe\u63a5<\/li>\n<\/ul>\n<\/li>\n<li>3. \u603b\u7ed3<\/li>\n<\/ul>\n<h2>1. \u4ece\u6e90\u7801\u5230\u53ef\u6267\u884c\u6587\u4ef6\u7684\u56db\u4e2a\u9636\u6bb5<\/h2>\n<p>\u5728Linux\u73af\u5883\u4e0b&#xff0c;\u5f53\u6211\u4eec\u4f7f\u7528 gcc \u6216 g&#043;&#043; \u7f16\u8bd1\u4ee3\u7801\u65f6&#xff0c;\u770b\u4f3c\u7b80\u5355\u7684\u4e00\u6761\u547d\u4ee4&#xff0c;\u80cc\u540e\u5176\u5b9e\u7ecf\u5386\u4e86\u56db\u4e2a\u590d\u6742\u7684\u9636\u6bb5\u3002<\/p>\n<p>\u4e0b\u9762\u7ed3\u5408\u5b9e\u4f8b\u6f14\u793a&#xff1a;<\/p>\n<p>\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a hello.c \u7684\u6587\u4ef6<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"157\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032242-6abdd2029e99a.png\" width=\"715\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"299\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032242-6abdd202afcc7.png\" width=\"1149\" \/><\/p>\n<p>\u8fd9\u56db\u4e2a\u9636\u6bb5\u5206\u522b\u662f&#xff1a;<\/p>\n<h3>1.1. \u9884\u5904\u7406<\/h3>\n<ul>\n<li>\n<p>\u9884\u5904\u7406\u9636\u6bb5\u662f\u7f16\u8bd1\u5668\u771f\u6b63\u5f00\u59cb\u5de5\u4f5c\u524d\u7684\u51c6\u5907\u3002\u5b83\u4e3b\u8981\u5904\u7406\u4ee5 # \u5f00\u5934\u7684\u9884\u5904\u7406\u6307\u4ee4\u3002<\/p>\n<\/li>\n<li>\n<p>\u5934\u6587\u4ef6\u5c55\u5f00&#xff1a;\u5c06 #include &lt;stdio.h&gt; \u66ff\u6362\u4e3a\u771f\u5b9e\u6587\u4ef6\u5185\u5bb9\u3002<\/p>\n<\/li>\n<li>\n<p>\u5b8f\u66ff\u6362&#xff1a;\u5c06 #define \u5b9a\u4e49\u7684\u5b8f&#xff08;\u5982 GREETING&#xff09;\u66ff\u6362\u4e3a\u5b9e\u9645\u503c\u3002<\/p>\n<\/li>\n<li>\n<p>\u53bb\u6ce8\u91ca&#xff1a;\u5220\u9664\u4ee3\u7801\u4e2d\u7684\u6ce8\u91ca&#xff0c;\u51cf\u5c11\u7f16\u8bd1\u4f53\u79ef\u3002<\/p>\n<\/li>\n<li>\n<p>\u6761\u4ef6\u7f16\u8bd1&#xff1a;\u6839\u636e #ifdef \u7b49\u6307\u4ee4\u51b3\u5b9a\u4fdd\u7559\u54ea\u4e9b\u4ee3\u7801\u3002<\/p>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"166\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032242-6abdd202e1f7a.png\" width=\"778\" \/><\/p>\n<ul>\n<li>\n<p>-E&#xff1a;\u8ba9 gcc \u5728\u9884\u5904\u7406\u7ed3\u675f\u540e\u505c\u6b62\u7f16\u8bd1\u8fc7\u7a0b\u3002<\/p>\n<\/li>\n<li>\n<p>-o&#xff1a;\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6&#xff0c;.i \u6587\u4ef6\u4e3a\u5df2\u7ecf\u8fc7\u9884\u5904\u7406\u7684 C \u539f\u59cb\u7a0b\u5e8f\u3002<\/p>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"438\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032243-6abdd203007dd.png\" width=\"1235\" \/><\/p>\n<h4><\/h4>\n<h3>1.2. \u7f16\u8bd1<\/h3>\n<p>\u5728\u8fd9\u4e2a\u9636\u6bb5&#xff0c;gcc \u9996\u5148\u8981\u68c0\u67e5\u4ee3\u7801\u7684\u89c4\u8303\u6027\u3001\u662f\u5426\u6709\u8bed\u6cd5\u9519\u8bef\u3002\u68c0\u67e5\u65e0\u8bef\u540e&#xff0c;gcc \u628a C \u4ee3\u7801\u7ffb\u8bd1\u6210\u6c47\u7f16\u8bed\u8a00\u3002<\/p>\n<ul>\n<li>\n<p>\u8fd9\u662f\u6574\u4e2a\u6d41\u7a0b\u4e2d\u6700\u8017\u65f6\u3001\u6700\u590d\u6742\u7684\u9636\u6bb5&#xff0c;\u5305\u542b\u4e86\u8bcd\u6cd5\u5206\u6790\u3001\u8bed\u6cd5\u5206\u6790\u3001\u8bed\u4e49\u5206\u6790\u3001\u4e2d\u95f4\u4ee3\u7801\u751f\u6210\u548c\u4f18\u5316\u7b49\u6b65\u9aa4\u3002<\/p>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"195\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032243-6abdd20341b8a.png\" width=\"954\" \/><\/p>\n<ul>\n<li>\n<p>-S&#xff1a;\u53ea\u8fdb\u884c\u7f16\u8bd1\u800c\u4e0d\u8fdb\u884c\u6c47\u7f16&#xff0c;\u751f\u6210\u6c47\u7f16\u4ee3\u7801\u3002<\/p>\n<\/li>\n<li>\n<p>\u751f\u6210\u7684 hello.s \u662f\u6587\u672c\u6587\u4ef6&#xff0c;\u91cc\u9762\u5305\u542b\u4e86 mov\u3001push\u3001call \u7b49\u6c47\u7f16\u6307\u4ee4\u3002<\/p>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"724\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032243-6abdd20359db7.png\" width=\"1310\" \/><\/p>\n<h3>1.3. \u6c47\u7f16 <\/h3>\n<p>\u6c47\u7f16\u9636\u6bb5\u662f\u628a\u7f16\u8bd1\u9636\u6bb5\u751f\u6210\u7684 .s \u6587\u4ef6\u8f6c\u6210\u76ee\u6807\u6587\u4ef6&#xff08;Object File&#xff09;\u3002\u6c47\u7f16\u5668\u5c06\u6c47\u7f16\u4ee3\u7801\u7ffb\u8bd1\u6210\u673a\u5668\u80fd\u8bc6\u522b\u7684\u4e8c\u8fdb\u5236\u6307\u4ee4\u3002<\/p>\n<ul>\n<li>\n<p>\u751f\u6210\u7684 .o \u6587\u4ef6\u88ab\u79f0\u4e3a\u53ef\u91cd\u5b9a\u4f4d\u76ee\u6807\u4e8c\u8fdb\u5236\u6587\u4ef6\u3002<\/p>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"227\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032243-6abdd203a5f22.png\" width=\"887\" \/><\/p>\n<ul>\n<li>\n<p>-c&#xff1a;\u5c06\u6c47\u7f16\u4ee3\u7801\u8f6c\u5316\u4e3a .o \u7684\u4e8c\u8fdb\u5236\u76ee\u6807\u4ee3\u7801\u3002<\/p>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"602\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032243-6abdd203bb0e6.png\" width=\"2549\" \/><\/p>\n<h4><\/h4>\n<h3>1.4. \u94fe\u63a5 <\/h3>\n<p>\u94fe\u63a5\u9636\u6bb5\u662f\u89e3\u51b3\u6a21\u5757\u95f4\u76f8\u4e92\u4f9d\u8d56\u7684\u95ee\u9898\u3002\u94fe\u63a5\u5668\u5c06\u6211\u4eec\u7684 .o \u6587\u4ef6\u4e0e\u7cfb\u7edf\u63d0\u4f9b\u7684\u6807\u51c6\u5e93&#xff08;\u5982 libc.so&#xff09;\u94fe\u63a5\u8d77\u6765&#xff0c;\u89e3\u51b3\u51fd\u6570\u8c03\u7528\u7684\u95ee\u9898\u3002<\/p>\n<ul>\n<li>\n<p>\u6211\u4eec\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\u7684 printf \u7b49\u51fd\u6570&#xff0c;\u5176\u771f\u6b63\u7684\u5b9e\u73b0\u5728 C \u6807\u51c6\u5e93\u4e2d\u3002<\/p>\n<\/li>\n<li>\n<p>\u94fe\u63a5\u5668\u4f1a\u53bb\u67e5\u627e printf \u5728\u5e93\u4e2d\u7684\u5730\u5740&#xff0c;\u5e76\u5c06\u5176\u4e0e\u6211\u4eec\u7684\u4ee3\u7801\u5173\u8054\u8d77\u6765\u3002<\/p>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"344\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032244-6abdd2046ca68.png\" width=\"1229\" \/><\/p>\n<p>\u6267\u884c\u540e&#xff0c;\u751f\u6210\u4e86\u53ef\u6267\u884c\u6587\u4ef6 hello\u3002\u6b64\u65f6&#xff0c;\u8fd9\u4e2a\u6587\u4ef6\u624d\u80fd\u88ab\u64cd\u4f5c\u7cfb\u7edf\u52a0\u8f7d\u8fd0\u884c<\/p>\n<p>\u4f7f\u7528 ldd hello \u547d\u4ee4\u53ef\u4ee5\u67e5\u770b\u53ef\u6267\u884c\u6587\u4ef6\u4f9d\u8d56\u7684\u52a8\u6001\u5e93<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"163\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032244-6abdd2049646f.png\" width=\"1024\" \/><\/p>\n<p>\u53ef\u4ee5\u770b\u5230&#xff0c;hello \u6210\u529f\u94fe\u63a5\u5230\u4e86 libc.so.6&#xff0c;\u8fd9\u5c31\u662f C \u8bed\u8a00\u6807\u51c6\u5e93\u3002<\/p>\n<p>\u53ef\u4ee5\u627e\u5230\u8be5\u5e93\u6240\u5728\u7684\u4f4d\u7f6e&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"108\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032244-6abdd204a7831.png\" width=\"1204\" \/><\/p>\n<\/p>\n<h2>2. <span style=\"color:#1f2329\">\u9759\u6001\u5e93\u548c\u52a8\u6001\u5e93<\/span><\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"991\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032244-6abdd204bd377.png\" width=\"1511\" \/><\/p>\n<h3>2.1 \u4ec0\u4e48\u662f\u5e93&#xff1f;<\/h3>\n<p>\u5728\u5199 C \u7a0b\u5e8f\u65f6&#xff0c;\u6211\u4eec\u7ecf\u5e38\u4f7f\u7528 printf \u51fd\u6570\u3002\u4f46\u4ed4\u7ec6\u56de\u60f3&#xff0c;\u6211\u4eec\u7684\u4ee3\u7801\u91cc\u5e76\u6ca1\u6709\u5b9a\u4e49 printf&#xff0c;\u5305\u542b\u7684 stdio.h \u91cc\u4e5f\u53ea\u6709\u5b83\u7684\u58f0\u660e&#xff0c;\u6ca1\u6709\u5b9e\u73b0\u3002<\/p>\n<p>\u90a3\u4e48 printf \u5230\u5e95\u5728\u54ea\u91cc\u5b9e\u73b0\u7684\u5462&#xff1f; \u7b54\u6848\u662f&#xff1a;\u7cfb\u7edf\u5c06\u8fd9\u4e9b\u5e38\u7528\u51fd\u6570\u7684\u5b9e\u73b0\u6253\u5305\u653e\u8fdb\u4e86\u540d\u4e3a libc.so.6&#xff08;C\u6807\u51c6\u5e93&#xff09;\u7684\u6587\u4ef6\u4e2d\u3002\u5f53\u6211\u4eec\u7f16\u8bd1\u7a0b\u5e8f\u65f6&#xff0c;GCC \u4f1a\u5230\u7cfb\u7edf\u9ed8\u8ba4\u7684\u641c\u7d22\u8def\u5f84&#xff08;\u5982 \/usr\/lib&#xff09;\u4e0b\u67e5\u627e\u5e76\u94fe\u63a5\u8fd9\u4e9b\u5e93\u3002<\/p>\n<p>\u5e93\u7684\u672c\u8d28&#xff1a;\u5c31\u662f\u4e00\u7ec4\u9884\u5148\u7f16\u8bd1\u597d\u7684\u3001\u53ef\u590d\u7528\u7684\u4e8c\u8fdb\u5236\u4ee3\u7801&#xff08;\u76ee\u6807\u6587\u4ef6 .o \u7684\u96c6\u5408&#xff09;\u3002\u6839\u636e\u94fe\u63a5\u65b9\u5f0f\u7684\u4e0d\u540c&#xff0c;\u5206\u4e3a\u9759\u6001\u5e93\u548c\u52a8\u6001\u5e93\u3002<\/p>\n<table>\n<tr>\u5e73\u53f0\u9759\u6001\u5e93\u540e\u7f00\u52a8\u6001\u5e93\u540e\u7f00<\/tr>\n<tbody>\n<tr>\n<td>Linux<\/td>\n<td>.a (Archive)<\/td>\n<td>.so (Shared Object)<\/td>\n<\/tr>\n<tr>\n<td>Windows<\/td>\n<td>.lib<\/td>\n<td>.dll<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>2.2 \u9759\u6001\u94fe\u63a5<\/h3>\n<p>\u9759\u6001\u94fe\u63a5\u662f\u6307\u5728\u7f16\u8bd1\u94fe\u63a5\u65f6&#xff0c;\u628a\u5e93\u6587\u4ef6\u7684\u4ee3\u7801\u5168\u90e8\u52a0\u5165\u5230\u53ef\u6267\u884c\u6587\u4ef6\u4e2d\u3002\u5c31\u50cf\u56fe\u7247\u8bb2\u4e49\u4e2d\u603b\u7ed3\u7684&#xff1a;\u201c\u628a\u5e93\u4e2d\u7684\u65b9\u6cd5&#xff08;\u6211\u4eec\u7a0b\u5e8f\u9700\u8981\u7684&#xff09;&#xff0c;\u76f4\u63a5\u62f7\u8d1d\u5230\u4f60\u7684\u7a0b\u5e8f\u4e2d\u201d\u3002<\/p>\n<p>\u751f\u6d3b\u6bd4\u55bb&#xff1a; \u4f60\u60f3\u770b\u4e00\u672c\u4e66&#xff08;\u4f7f\u7528\u5e93\u51fd\u6570&#xff09;&#xff0c;\u9759\u6001\u94fe\u63a5\u7684\u505a\u6cd5\u662f\u76f4\u63a5\u53bb\u4e70\u4e00\u53f0\u590d\u5370\u673a&#xff08;\u5c06\u5e93\u4ee3\u7801\u62f7\u8d1d\u8fdb\u7a0b\u5e8f&#xff09;&#xff0c;\u628a\u8fd9\u672c\u4e66\u590d\u5370\u4e00\u4efd\u653e\u5728\u5bb6\u91cc\u3002<\/p>\n<ul>\n<li>\n<p>\u4f18\u70b9&#xff1a;\u4ee5\u540e\u770b\u4e66\u518d\u4e5f\u4e0d\u7528\u51fa\u95e8\u4e86\u3002\u7a0b\u5e8f\u8fd0\u884c\u65f6\u4e0d\u518d\u4f9d\u8d56\u5916\u90e8\u5e93&#xff0c;\u8fd0\u884c\u901f\u5ea6\u5feb&#xff0c;\u79fb\u690d\u65b9\u4fbf\u3002<\/p>\n<\/li>\n<li>\n<p>\u7f3a\u70b9&#xff1a;<\/p>\n<li>\n<p>\u6d6a\u8d39\u7a7a\u95f4&#xff1a;\u5982\u679c\u591a\u4e2a\u7a0b\u5e8f\u90fd\u7528\u4e86 printf&#xff0c;\u90a3\u4e48\u6bcf\u4e2a\u7a0b\u5e8f\u91cc\u90fd\u6709\u4e00\u4efd printf \u7684\u526f\u672c&#xff0c;\u5185\u5b58\u4e2d\u5b58\u5728\u5927\u91cf\u91cd\u590d\u4ee3\u7801\u3002<\/p>\n<\/li>\n<li>\n<p>\u66f4\u65b0\u56f0\u96be&#xff1a;\u5982\u679c\u5e93\u51fd\u6570\u53d1\u73b0\u4e86 Bug \u9700\u8981\u4fee\u6539&#xff0c;\u6240\u6709\u4f7f\u7528\u4e86\u8be5\u9759\u6001\u5e93\u7684\u7a0b\u5e8f\u90fd\u5fc5\u987b\u91cd\u65b0\u7f16\u8bd1\u94fe\u63a5\u3002<\/p>\n<\/li>\n<\/li>\n<\/ul>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<h4>2.2.1. \u9996\u5148&#xff0c;\u786e\u4fdd\u7cfb\u7edf\u5b89\u88c5\u4e86\u9759\u6001\u5e93&#xff08;\u4e00\u822c\u4e91\u670d\u52a1\u5668\u9ed8\u8ba4\u6ca1\u88c5&#xff09;&#xff1a;<\/h4>\n<p># CentOS \u7cfb\u7edf\u5b89\u88c5\u9759\u6001\u5e93<br \/>\nyum install glibc-static libstdc&#043;&#043;-static -y <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1035\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032245-6abdd20599b3c.png\" width=\"2526\" \/><\/p>\n<h4>2.2.2. \u4f7f\u7528 -static \u9009\u9879\u5f3a\u5236\u8fdb\u884c\u9759\u6001\u94fe\u63a5&#xff1a;<\/h4>\n<p>[x&#064;localhost ~]$ gcc code.c -o code-static -static <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"101\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032246-6abdd2069007c.png\" width=\"1084\" \/><\/p>\n<h4>2.2.3. \u89c2\u5bdf\u6587\u4ef6\u5927\u5c0f\u53d8\u5316&#xff08;\u6ce8\u610f code \u662f\u52a8\u6001\u94fe\u63a5&#xff0c;code-static \u662f\u9759\u6001\u94fe\u63a5&#xff09;&#xff1a;<\/h4>\n<p>[x&#064;localhost ~]$ ll<br \/>\n-rwxr-xr-x 1 xin xin   8360 code<br \/>\n-rwxr-xr-x 1 xin xin 861288 code-static  # \u4f53\u79ef\u5267\u589e&#xff01; <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"255\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032246-6abdd206a55ff.png\" width=\"992\" \/><\/p>\n<h4>2.2.4.\u9a8c\u8bc1\u94fe\u63a5\u65b9\u5f0f&#xff1a;<\/h4>\n<p>[x&#064;localhost ~]$ file code-static<br \/>\ncode-static: ELF 64-bit LSB executable, x86-64, &#8230; statically linked &#8230;<br \/>\n# \u63d0\u793a statically linked&#xff0c;\u8bf4\u660e\u662f\u9759\u6001\u94fe\u63a5 <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"188\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032246-6abdd206bb6ce.png\" width=\"2228\" \/><\/p>\n<\/p>\n<h3>2.3 \u52a8\u6001\u94fe\u63a5<\/h3>\n<p>\u52a8\u6001\u94fe\u63a5\u7684\u57fa\u672c\u601d\u60f3\u662f\u628a\u7a0b\u5e8f\u6309\u7167\u6a21\u5757\u62c6\u5206\u6210\u5404\u4e2a\u76f8\u5bf9\u72ec\u7acb\u90e8\u5206&#xff0c;\u5728\u7a0b\u5e8f\u8fd0\u884c\u65f6\u624d\u5c06\u5b83\u4eec\u94fe\u63a5\u5728\u4e00\u8d77\u5f62\u6210\u4e00\u4e2a\u5b8c\u6574\u7684\u7a0b\u5e8f&#xff0c;\u800c\u4e0d\u662f\u50cf\u9759\u6001\u94fe\u63a5\u4e00\u6837\u628a\u6240\u6709\u7a0b\u5e8f\u6a21\u5757\u90fd\u94fe\u63a5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<p>\u7b80\u5355\u6765\u8bf4&#xff1a;\u53ef\u6267\u884c\u6587\u4ef6\u4e2d\u4e0d\u5305\u542b\u5e93\u7684\u4ee3\u7801&#xff0c;\u53ea\u5305\u542b\u5e93\u7684\u5730\u5740\u5f15\u7528\u3002<\/p>\n<p>\u751f\u6d3b\u6bd4\u55bb&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u4f60\u5bb6&#xff08;\u4f60\u7684\u7a0b\u5e8f&#xff09;&#xff1a;\u53ea\u5305\u542b\u4e86\u4f60\u81ea\u5df1\u5199\u7684 main \u51fd\u6570\u4ee3\u7801\u3002<\/p>\n<\/li>\n<li>\n<p>\u7f51\u5427&#xff08;\u52a8\u6001\u5e93&#xff0c;\u5982 libc.so.6&#xff09;&#xff1a;\u63d0\u4f9b\u4e86\u5404\u79cd\u73b0\u6210\u7684\u670d\u52a1&#xff08;\u5982 printf \u51fd\u6570\u3001\u6570\u5b66\u8ba1\u7b97\u7b49&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u53bb\u7f51\u5427\u4e0a\u7f51&#xff08;\u51fd\u6570\u8df3\u8f6c&#xff09;&#xff1a;\u5f53\u4f60\u7684\u7a0b\u5e8f\u9700\u8981\u6253\u5370\u4e00\u53e5\u8bdd\u65f6&#xff0c;\u5b83\u4e0d\u4f1a\u81ea\u5df1\u9020\u4e00\u53f0\u6253\u5370\u673a&#xff08;\u4e0d\u50cf\u9759\u6001\u94fe\u63a5\u90a3\u6837\u628a\u4ee3\u7801\u62f7\u8d1d\u8fdb\u6765&#xff09;&#xff0c;\u800c\u662f\u62ff\u7740\u5730\u5740\u8dd1\u5230\u7f51\u5427&#xff08;\u8df3\u8f6c\u5230\u52a8\u6001\u5e93&#xff09;&#xff0c;\u501f\u7528\u7f51\u5427\u7684\u6253\u5370\u673a&#xff08;\u6267\u884c\u5e93\u51fd\u6570&#xff09;&#xff0c;\u6253\u5370\u5b8c\u518d\u56de\u5bb6&#xff08;\u8fd4\u56de\u7a0b\u5e8f&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u6d3e\u51fa\u6240&#xff08;\u7cfb\u7edf\u73af\u5883&#xff09;&#xff1a;\u8d1f\u8d23\u7ba1\u7406\u8fd9\u4e9b\u7f51\u5427\u3002\u5982\u679c\u7f51\u5427\u88ab\u67e5\u5c01\u4e86&#xff08;\u5e93\u6587\u4ef6\u4e22\u5931&#xff09;&#xff0c;\u6216\u8005\u6d3e\u51fa\u6240\u628a\u7f51\u5427\u7684\u5730\u5740\u6539\u4e86&#xff0c;\u4f60\u518d\u53bb\u4e0a\u7f51\u5c31\u4f1a\u627e\u4e0d\u5230\u5730\u65b9&#xff08;\u7a0b\u5e8f\u62a5\u9519 error while loading shared libraries&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u8fd9\u4e2a\u6bd4\u55bb\u5b8c\u7f8e\u8be0\u91ca\u4e86\u52a8\u6001\u94fe\u63a5\u7684\u672c\u8d28&#xff1a;<\/p>\n<li>\n<p>\u5171\u4eab&#xff1a;\u6574\u4e2a\u7cfb\u7edf\u5185\u5b58\u4e2d&#xff0c;libc.so \u53ea\u9700\u8981\u5b58\u5728\u4e00\u4efd&#xff0c;\u6240\u6709\u7a0b\u5e8f\u5171\u7528&#xff08;\u7f51\u5427\u53ea\u6709\u4e00\u5bb6&#xff0c;\u5927\u5bb6\u90fd\u80fd\u53bb&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f9d\u8d56&#xff1a;\u7a0b\u5e8f\u8fd0\u884c\u79bb\u4e0d\u5f00\u8fd9\u4e2a\u5916\u90e8\u73af\u5883&#xff08;\u7f51\u5427\u5173\u95e8&#xff0c;\u4f60\u5c31\u4e0a\u4e0d\u4e86\u7f51&#xff09;\u3002<\/p>\n<\/li>\n<p>\u57fa\u4e8e\u4e0a\u8ff0\u539f\u7406&#xff0c;\u52a8\u6001\u94fe\u63a5\u62e5\u6709\u975e\u5e38\u660e\u663e\u7684\u4f18\u7f3a\u70b9&#xff1a;<\/p>\n<p>\u4f18\u70b9&#xff1a;<\/p>\n<li>\n<p>\u8282\u7701\u7a7a\u95f4&#xff1a;\u53ef\u6267\u884c\u6587\u4ef6\u4f53\u79ef\u5c0f&#xff0c;\u4e14\u591a\u4e2a\u7a0b\u5e8f\u5171\u4eab\u540c\u4e00\u4efd\u5e93\u6587\u4ef6&#xff0c;\u6781\u5927\u5730\u8282\u7701\u4e86\u78c1\u76d8\u548c\u5185\u5b58\u7a7a\u95f4\u3002<\/p>\n<\/li>\n<li>\n<p>\u66f4\u65b0\u65b9\u4fbf&#xff1a;\u5982\u679c\u5e93\u51fd\u6570\u53d1\u73b0\u4e86 Bug \u9700\u8981\u4fee\u6539&#xff0c;\u53ea\u8981\u63a5\u53e3\u4e0d\u53d8&#xff0c;\u6240\u6709\u4f9d\u8d56\u5b83\u7684\u7a0b\u5e8f\u65e0\u9700\u91cd\u65b0\u7f16\u8bd1&#xff0c;\u76f4\u63a5\u66ff\u6362\u5e93\u6587\u4ef6\u5373\u53ef&#xff08;\u7f51\u5427\u6362\u4e86\u65b0\u7535\u8111&#xff0c;\u4f60\u4f9d\u7136\u53ef\u4ee5\u53bb\u4e0a\u7f51&#xff09;\u3002<\/p>\n<\/li>\n<p>\u7f3a\u70b9&#xff1a;<\/p>\n<li>\n<p>\u4f9d\u8d56\u6027\u5f3a&#xff1a;\u4e00\u65e6\u5e93\u7f3a\u5931\u6216\u7248\u672c\u4e0d\u517c\u5bb9&#xff0c;\u6240\u6709\u76f8\u5173\u7a0b\u5e8f\u90fd\u65e0\u6cd5\u8fd0\u884c&#xff08;\u201c\u4e00\u65e6\u5e93\u7f3a\u5931&#xff0c;\u6240\u6709\u76f8\u5173\u7a0b\u5e8f&#xff0c;\u65e0\u6cd5\u8fd0\u884c\u4e86&#xff01;\u201d\u2014\u2014\u5f15\u81ea\u7b14\u8bb0&#xff09;\u3002<\/p>\n<\/li>\n<li>\n<p>\u6027\u80fd\u7565\u4f4e&#xff1a;\u9700\u8981\u989d\u5916\u7684\u51fd\u6570\u8df3\u8f6c&#xff08;\u5bfb\u5740&#xff09;&#xff0c;\u6bd4\u9759\u6001\u94fe\u63a5\u7a0d\u5fae\u6162\u4e00\u70b9\u70b9&#xff0c;\u4f46\u73b0\u4ee3\u8ba1\u7b97\u673a\u5b8c\u5168\u53ef\u4ee5\u5ffd\u7565\u4e0d\u8ba1\u3002<\/p>\n<\/li>\n<p>\u793a\u4f8b&#xff1a;<\/p>\n<h4>2.3.1. \u7f16\u8bd1\u7a0b\u5e8f<\/h4>\n<p>\u9996\u5148&#xff0c;\u786e\u4fdd\u4f60\u6709\u4e00\u4e2a\u6d4b\u8bd5\u6587\u4ef6&#xff08;\u4f8b\u5982 hello.c&#xff09;&#xff0c;\u7136\u540e\u76f4\u63a5\u4f7f\u7528\u9ed8\u8ba4\u7684 gcc \u547d\u4ee4\u7f16\u8bd1&#xff1a;<\/p>\n<p>gcc hello.c -o hello <\/p>\n<h4><\/h4>\n<h4>2.3.2. \u89c2\u5bdf\u6587\u4ef6\u5927\u5c0f<\/h4>\n<p>\u4f7f\u7528 ll \u547d\u4ee4\u67e5\u770b\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6&#xff1a;<\/p>\n<p>[xin&#064;my-centos ~]$ ll<br \/>\n-rwxr-xr-x 1 xin xin 8360 Sep 29 15:00 hello <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"266\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032246-6abdd206f1007.png\" width=\"855\" \/><\/p>\n<p>\u4f60\u4f1a\u53d1\u73b0 hello \u53ea\u6709\u533a\u533a 8360 \u5b57\u8282&#xff08;8KB\u5de6\u53f3&#xff09;\u3002\u5982\u679c\u662f\u9759\u6001\u94fe\u63a5&#xff0c;\u8fd9\u4e2a\u6587\u4ef6\u901a\u5e38\u4f1a\u6709 800KB \u4ee5\u4e0a\u3002\u8fd9\u5c31\u662f\u52a8\u6001\u94fe\u63a5\u201c\u8282\u7701\u7a7a\u95f4\u201d\u7684\u76f4\u63a5\u4f53\u73b0\u3002<\/p>\n<p>[xin&#064;my-centos ~]$ file hello<br \/>\nhello: ELF 64-bit LSB executable, x86-64, &#8230; dynamically linked &#8230; <\/p>\n<h4 style=\"background-color:transparent\">2.3.3. \u67e5\u770b\u4f9d\u8d56\u7684\u52a8\u6001\u5e93<\/h4>\n<p>\u6211\u4eec\u4f7f\u7528 ldd \u547d\u4ee4\u6765\u67e5\u770b\u8fd9\u4e2a\u53ef\u6267\u884c\u7a0b\u5e8f\u5230\u5e95\u4f9d\u8d56\u4e86\u54ea\u4e9b\u52a8\u6001\u5e93&#xff1a;<\/p>\n<p>[xin&#064;my-centos ~]$ ldd hello<br \/>\n    linux-vdso.so.1 (0x00007fff&#8230;)<br \/>\n    libc.so.6 &#061;&gt; \/lib64\/libc.so.6 (0x00007f&#8230;)<br \/>\n    \/lib64\/ld-linux-x86-64.so.2 (0x00007f&#8230;) <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"149\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032247-6abdd207144df.png\" width=\"971\" \/><\/p>\n<ul>\n<li>\n<p>ldd&#xff1a;\u7528\u4e8e\u6253\u5370\u7a0b\u5e8f\u6216\u8005\u5e93\u6587\u4ef6\u6240\u4f9d\u8d56\u7684\u5171\u4eab\u5e93\u5217\u8868\u3002<\/p>\n<\/li>\n<li>\n<p>libc.so.6 &#061;&gt; \/lib64\/libc.so.6&#xff1a;\u8bf4\u660e\u6211\u4eec\u7684\u7a0b\u5e8f\u4f9d\u8d56\u4e8e C \u6807\u51c6\u5e93&#xff0c;\u5e76\u4e14\u7cfb\u7edf\u627e\u5230\u4e86\u5b83\u5728 \/lib64\/ \u76ee\u5f55\u4e0b\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>2.3.4. \u9a8c\u8bc1\u94fe\u63a5\u65b9\u5f0f<\/h4>\n<p>\u4f7f\u7528 file \u547d\u4ee4\u786e\u8ba4\u53ef\u6267\u884c\u6587\u4ef6\u7684\u94fe\u63a5\u5c5e\u6027&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1222\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032247-6abdd207241d4.png\" width=\"6522\" \/><\/p>\n<ul>\n<li>\n<p>dynamically linked&#xff1a;\u660e\u786e\u63d0\u793a\u8fd9\u662f\u52a8\u6001\u94fe\u63a5\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>2.3.5. \u5e95\u5c42\u539f\u7406&#xff1a;\u67e5\u770b\u5e93\u7684\u771f\u5b9e\u9762\u76ee<\/h4>\n<p>\u5982\u679c\u4f60\u67e5\u770b \/lib64\/libc.so.6&#xff0c;\u4f60\u4f1a\u53d1\u73b0\u5b83\u53ea\u662f\u4e00\u4e2a\u8f6f\u94fe\u63a5&#xff08;\u7c7b\u4f3c\u4e8e Windows \u7684\u5feb\u6377\u65b9\u5f0f&#xff09;&#xff0c;\u6307\u5411\u771f\u6b63\u7684\u5b9e\u4f53\u6587\u4ef6&#xff1a;<\/p>\n<p>[xin&#064;my-centos ~]$ ls -l \/lib64\/libc.so.6<br \/>\nlrwxrwxrwx 1 root root 12 Oct 16 2024 \/lib64\/libc.so.6 -&gt; libc-2.17.so <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"151\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032247-6abdd20788a86.png\" width=\"1005\" \/><\/p>\n<p>\u8fd9\u8bf4\u660e\u7cfb\u7edf\u901a\u8fc7\u8f6f\u94fe\u63a5\u7684\u65b9\u5f0f&#xff0c;\u65b9\u4fbf\u5730\u8fdb\u884c\u5e93\u7684\u7248\u672c\u7ba1\u7406&#xff08;\u6bd4\u5982\u4ee5\u540e\u5347\u7ea7\u4e86&#xff0c;\u53ea\u9700\u4fee\u6539\u8f6f\u94fe\u63a5\u6307\u5411 libc-2.18.so \u5373\u53ef&#xff0c;\u7a0b\u5e8f\u4e0d\u7528\u52a8&#xff09;\u3002<\/p>\n<\/p>\n<h2>3. \u603b\u7ed3<\/h2>\n<table>\n<tr>\u7279\u6027\u9759\u6001\u94fe\u63a5\u52a8\u6001\u94fe\u63a5<\/tr>\n<tbody>\n<tr>\n<td>\u94fe\u63a5\u65f6\u673a<\/td>\n<td>\u7f16\u8bd1\u65f6&#xff08;\u62f7\u8d1d\u4ee3\u7801\u8fdb\u7a0b\u5e8f&#xff09;<\/td>\n<td>\u8fd0\u884c\u65f6&#xff08;\u52a0\u8f7d\u5e93\u5730\u5740&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u5185\u5b58\u5360\u7528<\/td>\n<td>\u5927&#xff08;\u6bcf\u4e2a\u7a0b\u5e8f\u90fd\u6709\u526f\u672c&#xff09;<\/td>\n<td>\u5c0f&#xff08;\u591a\u4e2a\u7a0b\u5e8f\u5171\u4eab\u540c\u4e00\u4efd\u5e93&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u8fd0\u884c\u901f\u5ea6<\/td>\n<td>\u5feb&#xff08;\u65e0\u8df3\u8f6c\u5f00\u9500&#xff09;<\/td>\n<td>\u7565\u6162&#xff08;\u6709\u51fd\u6570\u8df3\u8f6c\u5f00\u9500&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u66f4\u65b0\u7ef4\u62a4<\/td>\n<td>\u56f0\u96be&#xff08;\u9700\u91cd\u65b0\u7f16\u8bd1\u6240\u6709\u7a0b\u5e8f&#xff09;<\/td>\n<td>\u5bb9\u6613&#xff08;\u53ea\u9700\u66ff\u6362\u5e93\u6587\u4ef6&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u9002\u7528\u573a\u666f<\/td>\n<td>\u5bf9\u6027\u80fd\u8981\u6c42\u6781\u9ad8\u3001\u72ec\u7acb\u53d1\u5e03\u7684\u5de5\u5177<\/td>\n<td>\u5927\u90e8\u5206\u5e38\u89c4\u5f00\u53d1\u3001\u7cfb\u7edf\u7ea7\u5e94\u7528<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d&#xff0c;\u52a8\u6001\u94fe\u63a5\u8fdc\u6bd4\u9759\u6001\u94fe\u63a5\u5e38\u7528\u5f97\u591a\u3002\u8fd9\u4e5f\u662f GCC \u9ed8\u8ba4\u7684\u7f16\u8bd1\u65b9\u5f0f\u3002\u5b83\u7b26\u5408\u6a21\u5757\u5316\u5f00\u53d1\u7684\u601d\u60f3&#xff0c;\u6781\u5927\u5730\u8282\u7701\u4e86\u7cfb\u7edf\u8d44\u6e90\u548c\u7ef4\u62a4\u6210\u672c\u3002\u6211\u4eec\u5e38\u7528\u7684 C \u6807\u51c6\u5e93\u3001C&#043;&#043; \u6807\u51c6\u5e93&#xff08;libstdc&#043;&#043;&#xff09;\u7b49&#xff0c;\u90fd\u662f\u52a8\u6001\u5e93\u3002<\/p>\n<\/p>\n<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u5f55<br \/>\n1. \u4ece\u6e90\u7801\u5230\u53ef\u6267\u884c\u6587\u4ef6\u7684\u56db\u4e2a\u9636\u6bb5 1.1. \u9884\u5904\u74061.2. \u7f16\u8bd11.3. \u6c47\u7f161.4. \u94fe\u63a5 2. \u9759\u6001\u5e93\u548c\u52a8\u6001\u5e93 2.1 \u4ec0\u4e48\u662f\u5e93&#xff1f;2.2 \u9759\u6001\u94fe\u63a52.3 \u52a8\u6001\u94fe\u63a5 3. \u603b\u7ed3<br \/>\n1. \u4ece\u6e90\u7801\u5230\u53ef\u6267\u884c\u6587\u4ef6\u7684\u56db\u4e2a\u9636\u6bb5<br \/>\n\u5728Linux\u73af\u5883\u4e0b&#xff0c;\u5f53\u6211\u4eec\u4f7f\u7528 gcc \u6216 g \u7f16\u8bd1\u4ee3\u7801\u65f6&#xff0c;\u770b\u4f3c\u7b80\u5355\u7684\u4e00\u6761\u547d\u4ee4&#xff0c;\u80cc\u540e\u5176\u5b9e\u7ecf\u5386\u4e86\u56db\u4e2a\u590d\u6742\u7684\u9636\u6bb5\u3002<br \/>\n\u4e0b\u9762\u7ed3\u5408\u5b9e\u4f8b\u6f14\u793a&#xff1a;<br \/>\n\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a hello.c \u7684\u6587\u4ef6 \u8fd9\u56db\u4e2a<\/p>\n","protected":false},"author":2,"featured_media":111600,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,43,44],"topic":[],"class_list":["post-111620","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u7f16\u8bd1\u5668gcc - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/111620.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u7f16\u8bd1\u5668gcc - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u76ee\u5f55 1. \u4ece\u6e90\u7801\u5230\u53ef\u6267\u884c\u6587\u4ef6\u7684\u56db\u4e2a\u9636\u6bb5 1.1. \u9884\u5904\u74061.2. \u7f16\u8bd11.3. \u6c47\u7f161.4. \u94fe\u63a5 2. \u9759\u6001\u5e93\u548c\u52a8\u6001\u5e93 2.1 \u4ec0\u4e48\u662f\u5e93&#xff1f;2.2 \u9759\u6001\u94fe\u63a52.3 \u52a8\u6001\u94fe\u63a5 3. \u603b\u7ed3 1. \u4ece\u6e90\u7801\u5230\u53ef\u6267\u884c\u6587\u4ef6\u7684\u56db\u4e2a\u9636\u6bb5 \u5728Linux\u73af\u5883\u4e0b&#xff0c;\u5f53\u6211\u4eec\u4f7f\u7528 gcc \u6216 g \u7f16\u8bd1\u4ee3\u7801\u65f6&#xff0c;\u770b\u4f3c\u7b80\u5355\u7684\u4e00\u6761\u547d\u4ee4&#xff0c;\u80cc\u540e\u5176\u5b9e\u7ecf\u5386\u4e86\u56db\u4e2a\u590d\u6742\u7684\u9636\u6bb5\u3002 \u4e0b\u9762\u7ed3\u5408\u5b9e\u4f8b\u6f14\u793a&#xff1a; \u521b\u5efa\u4e00\u4e2a\u540d\u4e3a hello.c \u7684\u6587\u4ef6 \u8fd9\u56db\u4e2a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/111620.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-01T03:22:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032242-6abdd2029e99a.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/111620.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/111620.html\",\"name\":\"\u7f16\u8bd1\u5668gcc - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-01T03:22:48+00:00\",\"dateModified\":\"2026-10-01T03:22:48+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/111620.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/111620.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/111620.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u7f16\u8bd1\u5668gcc\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u7f16\u8bd1\u5668gcc - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/111620.html","og_locale":"zh_CN","og_type":"article","og_title":"\u7f16\u8bd1\u5668gcc - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u76ee\u5f55 1. \u4ece\u6e90\u7801\u5230\u53ef\u6267\u884c\u6587\u4ef6\u7684\u56db\u4e2a\u9636\u6bb5 1.1. \u9884\u5904\u74061.2. \u7f16\u8bd11.3. \u6c47\u7f161.4. \u94fe\u63a5 2. \u9759\u6001\u5e93\u548c\u52a8\u6001\u5e93 2.1 \u4ec0\u4e48\u662f\u5e93&#xff1f;2.2 \u9759\u6001\u94fe\u63a52.3 \u52a8\u6001\u94fe\u63a5 3. \u603b\u7ed3 1. \u4ece\u6e90\u7801\u5230\u53ef\u6267\u884c\u6587\u4ef6\u7684\u56db\u4e2a\u9636\u6bb5 \u5728Linux\u73af\u5883\u4e0b&#xff0c;\u5f53\u6211\u4eec\u4f7f\u7528 gcc \u6216 g \u7f16\u8bd1\u4ee3\u7801\u65f6&#xff0c;\u770b\u4f3c\u7b80\u5355\u7684\u4e00\u6761\u547d\u4ee4&#xff0c;\u80cc\u540e\u5176\u5b9e\u7ecf\u5386\u4e86\u56db\u4e2a\u590d\u6742\u7684\u9636\u6bb5\u3002 \u4e0b\u9762\u7ed3\u5408\u5b9e\u4f8b\u6f14\u793a&#xff1a; \u521b\u5efa\u4e00\u4e2a\u540d\u4e3a hello.c \u7684\u6587\u4ef6 \u8fd9\u56db\u4e2a","og_url":"https:\/\/www.wsisp.com\/helps\/111620.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-01T03:22:48+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001032242-6abdd2029e99a.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/111620.html","url":"https:\/\/www.wsisp.com\/helps\/111620.html","name":"\u7f16\u8bd1\u5668gcc - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-01T03:22:48+00:00","dateModified":"2026-10-01T03:22:48+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/111620.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/111620.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/111620.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u7f16\u8bd1\u5668gcc"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/111620","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=111620"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/111620\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/111600"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=111620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=111620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=111620"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=111620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}