锘??xml version="1.0" encoding="utf-8" standalone="yes"?>C++鍗氬-Prayerhttp://www.9087120.com/prayer/鍦竴鑸腑瀵绘眰鍗撹秺zh-cnThu, 21 Mar 2019 08:50:47 GMTThu, 21 Mar 2019 08:50:47 GMT60ue宸晶鐨勮祫婧愮鐞嗗櫒闅愯棌浜嗘庝箞璋冨嚭鏉?/title><link>http://www.9087120.com/prayer/archive/2019/03/21/216305.html</link><dc:creator>Prayer</dc:creator><author>Prayer</author><pubDate>Thu, 21 Mar 2019 06:46:00 GMT</pubDate><guid>http://www.9087120.com/prayer/archive/2019/03/21/216305.html</guid><wfw:comment>http://www.9087120.com/prayer/comments/216305.html</wfw:comment><comments>http://www.9087120.com/prayer/archive/2019/03/21/216305.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/prayer/comments/commentRss/216305.html</wfw:commentRss><trackback:ping>http://www.9087120.com/prayer/services/trackbacks/216305.html</trackback:ping><description><![CDATA[<div>https://zhidao.baidu.com/question/337623541.html<br /><br /><span style="color: #333333; font-family: 'PingFang SC', 'Lantinghei SC', 'Microsoft YaHei', arial, 瀹嬩綋, sans-serif, tahoma; font-size: 16px; line-height: 26px; background-color: #ffffff;">鏁翠釜鏂囦欢瑙嗗浘涓?#29785;?#27996;嗗彲浠寜CTRL+U?#23516;?#22189;鏉紝FTP瑙嗗浘涓?#29785;?#27996;嗐傚彲浠偣鍑婚珮绾?#26916;?-銆嬮厤缃?-銆婩TP閫夐--銆?#37734;?#23092;?#29785;堝櫒瑙嗗浘?#22135;鏄剧FTP甯愭埛銆?/span></div><img src ="http://www.9087120.com/prayer/aggbug/216305.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/prayer/" target="_blank">Prayer</a> 2019-03-21 14:46 <a href="http://www.9087120.com/prayer/archive/2019/03/21/216305.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>鍔?#37804;佸簱(.so)閾炬帴闈欐佸簱(.a)鐨勬儏鍐垫荤粨http://www.9087120.com/prayer/archive/2019/03/20/216304.htmlPrayerPrayerWed, 20 Mar 2019 07:28:00 GMThttp://www.9087120.com/prayer/archive/2019/03/20/216304.htmlhttp://www.9087120.com/prayer/comments/216304.htmlhttp://www.9087120.com/prayer/archive/2019/03/20/216304.html#Feedback0http://www.9087120.com/prayer/comments/commentRss/216304.htmlhttp://www.9087120.com/prayer/services/trackbacks/216304.html鏉嚜锛歨ttp://www.cnblogs.com/nobugtodebug/archive/2012/11/07/e6cd72c67b3dd843f40d7ce919f7336a.html

鍔?#37804;佸簱(.so)閾炬帴闈欐佸簱(.a)鐨勬儏鍐垫荤粨 
?#31476;鑸?#37833;?#29831;?#37734;?#38334;炬帴鏃舵兂瑕佷娇鐢?#38344;欐佸簱鏈?#28051;?#32457;?#37826;?#23049;?#38171;?/div>
1銆乴ink鏃?#37716;?#28051;?-static 閫夐锛涘綋鍔?#28051;?-static閫夐鍚庯紝gcc?#32048;?#22968;鎵鏈?#37922;?#37714;?#37928;勫簱?#20824;鍋?#38344;欐佽繛?#24116;銆?/div>
2銆乴ink鏃剁洿?#24116;鎸?#28729;氭兂瑕?#38344;欐佽繛?#24116;鐨?a鏂囦欢鐨勭粷瀵硅矾寰?#37510;?#28028;樼偣鏄?#38340;?#38344;?a鏂囦欢涓嶅瓨鍦紝鍚?#37714;?#38002;?#28729;?#37832;?#37825;?#38171;涚己?#20579;?#31683;鏄?#23536;?#37828;?#37828;紝?#23297;鍒板叾浠?#37832;哄櫒涓?#32514;?#29831;?#37827;讹紝.a鏂囦欢?#31683;?#32320;椤?#37734;?#37929;?#37722;?#37928;勮矾寰?#28051;嬪瓨?#25985;銆?/div>
3銆?#37734;?#29781;?#38344;欐佽繛?#24116;鐨勫簱?#22688;鎸?#28729;?Bstatic ?#32029;鍦?#29781;?#37716;?#37804;佽繛?#24116;鐨勫簱?#22688;鎸?#28729;?Bdynamic閫夐銆傝繛?#24116;?#27346;鍦?#37930;嬪埌-Bstatic鏃朵細浼?#27996;?#37720;绘?#40515;?#27408;佸簱?#32029;濡?#37835;?#37813;?#28051;?#37714;?#37712;嶅?#32472;壘鍔?#37804;佸簱銆?-Bdynamic?#31683;鏄?#37722;屾牱鐨勬儏鍐?#37510;?/span>锛?span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; word-wrap: break-word; color: #ff0000;">?#24434;鏄?#37812;?#28729;?#26976;?#37928;勭粨鏋?#37828;繖涓釜閫夐?#35268;牴鏈?#28051;嶈捣浣?#37922;紝鎴?#37928;勭幆澧?#37828;痗entos 6.2 gcc4.7.2, 浠?#32513;嗙湅浜唃cc 鏂囨?#32029;?#32342;涓釜閫夐鏄拡瀵筕xWorks骞?#37721;?#37928;勶紝鎵浠?#28051;嶈捣浣?#37922;?#37510;?/span>锛?/div>
 
?#32139;鎴?#28000;?#29781;?#32514;?#29831;戜竴?#37340;so鎻愪?#28058;?#27407;閮娇鐢紝?#32342;?#37340;so鏈韩渚?#29863;栦竴浜涚涓?#37826;瑰簱銆備?#21976;槸鎴?#28000;?#37719;?#29999;?#37832;so鐨勪娇鐢?#38000;?#28051;?#37922;?#37711;冲璇so瀵瑰叾浠栧簱鐨勪緷璧?#37510;傚緢?#22172;?#21159;鐨?#37828;細?#20802;鍒?#37734;?#32514;?#29831;so鐨勬?#36346;欐妸渚?#29863;?#37714;?#37928;勭涓?#37826;瑰簱闈欐?#38334;炬帴杩?#37833;?#37510;?/div>
鎴?#37734;?#26473;欐牱鍋?#37928;勬?#36346;欑鍒?#27996;?#38338;?#26864;?#38171;?#37816;?#28729;?static閫夐鏃讹紝link澶辫触?#32029;?#25930;璇?#37819;愮璇?#29781;?#37922;?#37714;?#37928;刼bject鏂囦欢搴?#29831;?#37922;?fPIC閫夐閲?#37826;扮紪璇?#37813;嶈锛堜篃灏?#37828;?#29831;达紝鍙?#37832;?#37922;?fPIC閫夐缂?#29831;?#37928;刼bject鏂囦欢?#20824;琚link鍒?so?#22135;锛?#38171;涘綋?#27967;?#24116;缁欏嚭.a鐨勭粷瀵硅矾寰?#37928;勬?#36346;檒ink鎴?#37716;燂紝浣嗘槸.so?#22135;鍗村?#33333;病鏈夌洿姝寘鍚?#37813;鐢?#37714;?#37928;勭鍚堣繛?#24116;銆傞拡瀵圭鍒?#37928;?#38338;?#26864;橈紝鎴?#37707;?#27996;嗕竴浜?#28729;?#26976;?#37510;?#28729;?#26976;屽涓?#38171;?/div>
static.c

#include <stdio.h>
 
const char* sz_static = "i'm a static str.";
 
void print_niuzai_said()
{
    printf("in static lib, niu zai said, i'm happy!\n");
}

dynamic.c
 
#include <stdio.h>
#include "static.h"
 
void print_papa_said()
{
    print_niuzai_said();
    printf("in dynamic lib, papa said, niu zai is wonderful!\n");
}
 

main.c
 
#include <unistd.h>
#include "dynamic.h"
 
int main(int argc, char** argv)
{
    print_papa_said();
    return 0;
}
鍒嗗埆鐢?#28051;?#32513;勫懡浠?#32514;?#29831;戝嚭浜?#28051;釜.a 鏂囦欢
1銆乬cc -o static.o -c static.c
      ar -r libstatic.a static.o
2銆乬cc -o static_shared.o -shared -fPIC -c static.c
      ar -r libstatic_shared.a static_shared.o
 
鐒跺悗鐢?#23005;懡浠?nbsp; "gcc -o dynamic.o -c dynamic.c"  缂?#29831;戝嚭dynamic.o鏂囦欢
?#24116;涓?#37833;?#28751;?#37828;?#37832;?#37826;?#37928;?#28051;婚浜嗭紝閾炬帴鐢熸垚libdynamic.so.姝?#37827;舵湁?#32342;?#31646;鍑?#32457;嶆儏鍐?#38171;?/div>
1銆佷娇鐢?"gcc -o libdynamic.so -shared -fPIC -L. -lstatic dynamic.o "?#32029;?#32347;?#24116;鎴?#37716;燂紝浣?so?#22135;瀹?#38340;?#28051;病鏈static.o?#22135;鐨?#37712;?#28729;?#37510;?img src="http://images.cnblogs.com/cnblogs_com/nobugtodebug/201211/20121107132126610.png" border="0" alt="" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; max-width: 100%; word-wrap: break-word; cursor: -webkit-zoom-in; border: 0px;" />
2銆佷娇鐢?gcc -o libdynamic.so dynamic.o -shared -fPIC -L. -lstatic",?#32347;?#24116;澶辫触 
3銆佷娇鐢?"gcc -o libdynamic.so -shared -fPIC -L. -lstatic_shared dynamic.o"?#32029;?#32347;?#24116;鎴?#37716;燂紝浣?so?#22135;瀹?#38340;?#28051;病鏈static.o?#22135;杩?#37828;病鏈?#37928;?#37712;?#28729;?#37510;?/div>
 
4銆佷娇鐢?"gcc -o libdynamic.so dynamic.o -shared -fPIC -L. -lstatic_shared",?#32347;?#24116;鎴?#37716;燂紝.a鐨?#37712;?#28729;硅?#32347;?#24116;鍒?#27996;?so?#22135;闈?#37510;?/div>
 
 
鍙?#28598;栵紝閾炬帴闈欐?#37922;熸?#24876;彲鎵?#29723;岀?#23338;簭鏃讹紝闈欐佸簱鏄?#28051;?#37828;?#37922;?"-shared -fPIC" 閫夐缂?#29831;?#27996;?#37922;?#37928;勬病鏈夊奖鍝?#37510;傞兘?#20824;姝?#29999;?#37922;熸?#24876;彲鎵?#29723;岀?#23338;簭銆?/div>
缁?#37722;?#28000;?#28051;儏鍐碉紝鎬荤粨濡?#28051;?#38171;?/div>
1銆?#37716;?#37804;佽繛?#24116;?#31793;?#33105;鐢?#37714;?#37928;刼bject鏂囦欢?#32320;椤绘槸鐢?"-shared -fPIC"閫夐缂?#29831;?#27996;?#37922;?#37928;勶紝鍚?#37714;欒繛?#24116;鏃?#29781;佷箞?#23012;?#25930;?#32029;瑕佷箞琚?#36423;?#37923;?#37510;?/div>
2銆?#38344;欐佸簱?#33105;鐨刼bject鏂囦欢鏈濂戒篃鐢?-shared -fPIC"閫夐缂?#29831;戯紝杩欐牱闈欐佸簱灏卞彲浠?#37722;?#37827;惰?#32347;?#24116;鍒?so 鎴栬呭彲鎵?#29723;?#37804;?#37826;囦欢?#33105;銆?/div>
3銆?#37716;?#37804;佸簱鍙兘?#32347;?#24116;鐢?-shared -fPIC"閫夐缂?#29831;戝嚭鏉?#37928;?#38344;欐佸簱锛堝?#23680;1?#20579;鏄?#37722;屼竴?#27426;浜?#38171;?/div>
4銆佽繛?#24116;閫夐鐨?#26916;?#25652;?#28725;硅繛?#24116;?#27346;鐨勮涓?#37832;夐?#23944;?#20344;奖鍝?#38171;?/div>
 
闈欐佸簱?#23047;鐢?shared -fPIC?#32347;?#24116;?#25057;浠?/span>?#32347;?#24116;鎵?#29723;岀粨鏋?/span>鍔?#37804;佸簱?#31912;鏋?/span>鏈缁堢粨鏋?/span>
鍚?/td>gcc -o libdynamic.so -shared -fPIC -L. -lstatic dynamic.o鎴?#37716;?/td>闈欐佸簱鍐?#28729;规病鏈夎?#32347;?#24116;澶辫触
鍚?/td>gcc -o libdynamic.so dynamic.o -shared -fPIC -L. -lstatic澶辫触 澶辫触
鏄?/td>gcc -o libdynamic.so -shared -fPIC -L. -lstatic_shared dynamic.o鎴?#37716;?/td>闈欐佸簱鍐?#28729;规病鏈夎?#32347;?#24116;澶辫触
鏄?/td>gcc -o libdynamic.so dynamic.o -shared -fPIC -L. -lstatic_shared鎴?#37716;?/td>闈欐佸簱鍐?#28729;硅?#32347;?#24116;鎴?#37716;?/td>
 


Prayer 2019-03-20 15:28 鍙戣璇勮
]]>Linux Sftp 涓嬭浇鏁翠釜鏂囦欢鐩?#35120;?/title><link>http://www.9087120.com/prayer/archive/2019/03/18/216302.html</link><dc:creator>Prayer</dc:creator><author>Prayer</author><pubDate>Mon, 18 Mar 2019 06:42:00 GMT</pubDate><guid>http://www.9087120.com/prayer/archive/2019/03/18/216302.html</guid><wfw:comment>http://www.9087120.com/prayer/comments/216302.html</wfw:comment><comments>http://www.9087120.com/prayer/archive/2019/03/18/216302.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/prayer/comments/commentRss/216302.html</wfw:commentRss><trackback:ping>http://www.9087120.com/prayer/services/trackbacks/216302.html</trackback:ping><description><![CDATA[<p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; font-size: 16px; color: #4f4f4f; line-height: 26px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;"><span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Microsoft YaHei'; word-wrap: break-word;">?#27967;?#24116;鐪嬪浘锛?/span></p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; font-size: 16px; color: #4f4f4f; line-height: 26px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;"><img src="https://img-blog.csdn.net/20180503111757090" alt="" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; max-width: 100%; word-wrap: break-word; cursor: -webkit-zoom-in;" /></p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; font-size: 16px; color: #4f4f4f; line-height: 26px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">   </p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; font-size: 16px; color: #4f4f4f; line-height: 26px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;"><span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Microsoft YaHei'; word-wrap: break-word;">鏈?#28051;釜鐗圭偣锛?/span></p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px 27pt; padding: 0px; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; font-size: 16px; color: #4f4f4f; line-height: 26px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;"><span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Microsoft YaHei'; word-wrap: break-word;">1锛氫娇鐢?r鍙?#37825;?/span></p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px 27pt; padding: 0px; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; font-size: 16px; color: #4f4f4f; line-height: 26px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;"><span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Microsoft YaHei'; word-wrap: break-word;">2锛氬湪鐩?#35120;?#37722;?#38344;娇鐢?."鍙?br style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; word-wrap: break-word;" /> </span></p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; font-size: 16px; color: #4f4f4f; line-height: 26px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;"><span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Microsoft YaHei'; word-wrap: break-word;">杩欐牱鐨勮瘽灏卞彲浠妸</span>/opt/merkle <span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Microsoft YaHei'; word-wrap: break-word;">鐩?#35120;曞拰瀛愮洰褰噷闈?#37928;?#37826;囦欢?#21455;閮?#28051;嬭浇鍒?#37832;?#37734;?#27996;嗐?/span></p><img src ="http://www.9087120.com/prayer/aggbug/216302.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/prayer/" target="_blank">Prayer</a> 2019-03-18 14:42 <a href="http://www.9087120.com/prayer/archive/2019/03/18/216302.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>鐞嗘竻gcc銆乴ibc銆乴ibstdc++鐨勫叧绯?/title><link>http://www.9087120.com/prayer/archive/2019/03/18/216301.html</link><dc:creator>Prayer</dc:creator><author>Prayer</author><pubDate>Mon, 18 Mar 2019 06:27:00 GMT</pubDate><guid>http://www.9087120.com/prayer/archive/2019/03/18/216301.html</guid><wfw:comment>http://www.9087120.com/prayer/comments/216301.html</wfw:comment><comments>http://www.9087120.com/prayer/archive/2019/03/18/216301.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/prayer/comments/commentRss/216301.html</wfw:commentRss><trackback:ping>http://www.9087120.com/prayer/services/trackbacks/216301.html</trackback:ping><description><![CDATA[<div><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">?#32139;浣?#37734;linux涓嬪啓C/C++浠爜鐨勬?#36346;欙紝鏄?#28051;?#37828;細閬?#37714;?#29825;稿缂?#29831;?#38334;炬帴鐨?#38338;?#26864;?#38171;?鏃?#28051;?#37827;舵姤?#37340;glibc,gcc?#32029;g++绛夌?#31295;叧鐨勯敊璇?#38171;?寰?#28598;?#37827;跺欓兘鏃?#28000;庝笅鎵嬶紝鑰?#28051;?#23011;旇?#20905;؜涔?#37510;??#32342;?#31683;鏄?#32514;?#29831;?#38334;炬帴杩囩?#23337;腑缁?#29999;稿嚭?#24135;鐨?#38338;?#26864;?#37510;?/p><a id="more" target="_blank" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: #555555; cursor: pointer; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; word-wrap: break-word; background-color: #ffffff; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #cccccc; line-height: 28px;"></a><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">?#32342;?#30226;鏂囩珷涓?#37828;?#37720;?#28000;?#32513;嶅?#20633;綍缂?#29831;?#38334;炬帴?#32029;鑰?#37828;?#37918;嗘竻缂?#29831;?#38334;炬帴杩囩?#23337;腑纰?#37714;?#37928;勪竴浜涙?#20634;鍜屽嚭?#24135;鐨?#38338;?#26864;?#37510;傚挨?#21502;鏄紝libc,glib,glibc,eglibc,libc++,libstdc++,gcc,g++銆?/p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">浠巐ibc璇磋捣銆?br style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; word-wrap: break-word;" />libc鏄疞inux涓嬪師鏉?#37928;勬爣鍑咰?#31793;?#32029;?#31683;灏?#37828;綋鍒?#37712;hello world鏃跺寘鍚?#37928;?#28598;?#37826;囦欢#include < stdio.h> 瀹?#28052;?#37928;?#37734;?#37826;?#37510;?/p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">鍚?#37833;?#38315;愭?#24879;?#29604;libc鍙?#28000;紝?#31683;灏?#37828;?#28028;?#29831;翠腑鐨GNU C Library,鍦?#23005;?#28052;嬪墠闄?#27996;嗘湁libc?#32029;杩?#37832;塳libc,uclibc銆傜幇鍦?#37721;?#29781;佺煡閬?#37922;?#37928;勬渶澶?#37928;?#37828;痝libc灏辫浜嗭紝涓绘祦鐨勪竴浜沴inux鎿?#28003;滅?#33636;?#29111; Debian, Ubuntu?#32029;Redhat绛?#37922;?#37928;勯兘鏄痝libc锛?#37812;栬呭叾鍙?#32457;嶏紝涓嬮潰?#32048;璇村埌).</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">閭glibc?#20824;鍋?#27996;?#27996;?#28000;?#31646;鍛?#38171;?glibc鏄?a href="https://www.baidu.com/s?wd=Linux%E7%B3%BB%E7%BB%9F&tn=24004469_oem_dg&rsv_dl=gh_pl_sl_csd" target="_blank" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: #6795b5; text-decoration: none; cursor: pointer; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; word-wrap: break-word;">Linux绯荤粺</a>?#33105;鏈搴曞眰鐨凙PI?#32029;鍑犱?#24225;叾瀹?#28000;?#28003;?#37928;勮?#24879;?#23677;簱?#20824;瑕佷緷璧杇libc銆?glibc鏈涓?#29781;?#37928;?#37716;熻兘灏?#37828;?#28725;圭?#33636;粺璋?#37922;?#37928;?#28751;佽?#21635;紝浣犳兂?#20802;?#28229;?#32029;浣?#37804;庝箞?#20824;鍦C浠?#37934;佷腑?#27967;?#24116;鐢fopen鍑?#37825;板?#36779;兘鎵撳紑鏂囦欢锛?鎵撳紑鏂囦欢鏈缁?#26473;?#37828;?#29781;?#29785;?#37721;?#32495;荤粺?#33105;鐨sys_open绯荤粺璋?#37922;紝鑰岃繖?#33105;闂?#37928;?#28598;?#37918;?#26473;囩?#23342;兘鏄痝libc鏉?#28729;屾垚鐨?#37510;?a href="http://www.chongh.wiki/blog/2016/04/08/linux-syscalls/" rel="nofollow" target="_blank" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: #555555; text-decoration: none; cursor: pointer; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; word-wrap: break-word; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #cccccc;">?#32342;?#30226;鏂囩珷</a>璇?#32513;?#28000;?#32513;?#27996;唃libc鏄?#28641;備綍涓庝笂?#30512;搴?#37922;?#32459;嬪簭鍜岀?#33636;粺璋?#37922;?#27996;?#27996;?#37928;?#37510;?#38340;?#27996;嗗?#20349;绯荤粺璋?#37922;紝glibc?#22172;?#38889;?#31683;鎻愪緵浜嗕竴浜?#28051;婂眰搴?#37922;?#37713;?#37825;板繀瑕?#37928;?#37716;熻兘,濡俿tring,malloc,stdlib,linuxthreads,locale,signal绛夌瓑銆?/p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">濂?#27996;嗭紝閭eglibc鍙?#37828;?#28000;?#31646;锛??#32342;?#22135;鐨別鏄疎mbedded鐨勬剰鎬濓紝?#31683;灏?#37828;墠闈?#29831;村埌鐨?#37721;?#32457;glibc銆俥glibc鐨?#28051;?#29781;佺壒鎬?#37828;?#28051;?#27996;嗘?#26449;鐨勬敮鎸佸?#23677;叆?#32033;鏋舵?#21238;紝?#24434;浠敮鎸?#28051;?#37722;?#37928;shell(?#23512;?#23277;宓屽叆?#32033;)?#32029;浣嗗畠鏄?#27996;岃?#28056;?#36346;吋瀹筭libc鐨勶紝灏?#37828;?#29831;村鏋?#28003;?#37928;?#28000;?#37934;佷?#23338;墠渚?#29863;杄glibc?#31793;?#32029;閭箞鎹?#37812;glibc鍚庝篃涓嶉渶瑕侀噸鏂扮紪璇?#37510;?a href="https://www.baidu.com/s?wd=ubuntu%E7%B3%BB%E7%BB%9F&tn=24004469_oem_dg&rsv_dl=gh_pl_sl_csd" target="_blank" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: #6795b5; text-decoration: none; cursor: pointer; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; word-wrap: break-word;">ubuntu绯荤粺</a>鐢?#37928;?#28751;?#37828;eglibc锛堣?#28051;?#37828;痝libc锛?涓嶄俊?#32029;浣?#37813;?#29723;?ldd –version 鎴栬?/lib/i386-linux-gnu/libc.so.6<br style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; word-wrap: break-word;" />(64浣?#32495;荤粺杩愯/lib/x86_64-linux-gnu锛夌湅?#28229;?#32029;渚夸細鏄剧浣?#32495;荤粺?#33105;eglibc/glibc鐨勭増鏈俊鎭?#37510;??#32342;?#22135;鎻?#37714;?#27996;唋ibc.so.6,?#32342;?#37340;鏂囦欢灏?#37828;eglibc/glibc缂?#29831;?#37722;?#37928;?#37922;熸?#24876;簱鏂囦欢銆?/p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">杩?#37832;変竴?#37340;glib?#28229;?#25443;鏉篃寰?#37929;?#28028;硷紝閭?#28729;冨張鏄?#28000;?#31646;鍛?#38171;焔lib?#31683;鏄釜c绋嬪簭?#31793;?#32029;涓嶈?#22248;?#26055;?#20909;?#23130;噺绾紝glib灏咰璇言?#33105;鐨?#37825;?#37817;?#32491;诲瀷缁熶竴灏佽鎴愯嚜宸?#37928;?#37825;?#37817;?#32491;诲?#23350;紝鎻愪緵浜咰璇言甯?#37922;?#37928;?#37825;?#37817;粨鏋?#37928;?#28729;?#28052;?#28000;?#37721;?#28598;?#37918;嗗嚱鏁帮紝鏈夎鐨?#28729;?#28000;?#37721;婂彲绉绘鐨?#28751;佽绛?娉?#38171;glib鏄彲绉绘鐨勶紝璇?#37828;庝綘?#24434;浠?#37734;linux涓嬶紝?#31683;?#24434;浠?#37734;windows涓嬩娇鐢?#28729;?#38171;?#37510;傞偅瀹冭?#28948;libc鏈?#28000;?#31646;?#21479;绯?#37722;?#38171;熷叾瀹?#39582;舵病鏈紝闄?#38344;?#28003;?#37928;勭?#23338;簭浠?#37934;佷細鐢?#37714;glib?#31793;?#33105;鐨?#37825;?#37817;粨鏋勬?#26668;?#37713;?#37825;帮紝glib?#31793;鍦ubuntu绯荤粺?#33105;骞?#28051;嶄細榛?#29825;?#28729;夎(?#24434;浠?#38315;?#26473;apt-get install libglib2.0-dev鎵嬪姩瀹夎)?#32029;?#25010;鍚?#37928;GTK+?#25328;Gnome搴曞眰鐢?#37928;勯兘鏄痝lib?#31793;銆傛兂?#27967;璇?#32513;?#27996;?#29785;glib锛??#24434;浠?#37721;傝?a href="https://developer.gnome.org/glib/" rel="nofollow" target="_blank" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: #555555; text-decoration: none; cursor: pointer; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; word-wrap: break-word; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #cccccc;">?#32342;?#22135;</a></p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">鐪嬪埌?#32342;?#22135;?#32029;浣?#25652;?#29831;煡閬撹繖浜涘簱鏈夊?#27702;?#23944;浜嗗锛?浣?#37712;?#37928;凜浠爜鍦?#32514;?#29831;?#37928;勮?#22249;?#23337;腑鏈夊彲?#20824;?#22189;?#24135;鏄?#37828;?#37828;繖浜涘簱?#22135;闈?#28729;?#28052;?#37928;?#37721;?鍗?#38322;忚繕浼氬嚭?#24135;’Undefined’, ‘Unreference’绛夐敊璇紝杩欐?#36346;?#28003;犲彲?#20824;?#32048;鎬鐤?#37828;?#28051;?#37828;繖浜涘簱?#22189;闂?#26864;?#27996;?#38171;?鏄?#28051;?#37828;?#29831;?#37716;?#37813;嬫崲?#37340;gilbc/eglibc浜?#38171;??#32342;?#22135;?#24049;璋冧竴?#20579;?#32029;鍦?#28003;?#37713;嗗?#22248;洿鎹?鍗?#32510;繖浜涘簱涔嬪墠?#32029;浣?#25652;?#29831;?#28610;?#28610;?#37804;濊冧竴涓嬶紝浣?#37930;?#37928;勮?#20345;洿鎹?鍗?#32510;?#37722;?#38171;?#28003;?#29781;佺煡閬?#28003;犺嚜宸?#37734;?#37707;?#28000;?#31646;锛佷綘瑕?#37827;跺?#33636;煡閬glibc/eglibc鐨?#35120;?#37725;?#37832;夊?#27692;?#32029;涓嶇浣犱?#23338;墠閮?#32515;?#37928;?#28000;?#31646;绋嬪簭?#32029;linux绯荤粺鐨刲s,cd,mv,ps绛夌?#22794;叏?#20824;寰?#28186;?#29863;?#28729;紝寰?#28598;?#27996;?#37734;洿鎹?鍗?#32510;兘鏈?#26473;囨儴鐥?#37928;?#37825;?#29825;紝鐢?#38007;?#29825;?#37825;翠釜绯荤?#29111;婧?#37827;?#23049;?#37722;?#37716;?#37510;?#37813;浠紝?#24049;?#20755;涓嶅?#40511;?#27967;鎹?鍗?#32510;繖浜涘簱锛?/p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">?#32139;鐒跺鏋?#28003;?#37712;?#37928;?#37828;疌++浠爜?#32029;杩?#37832;?#28051;釜?#31793;?#31683;瑕?#38344;?#29999;?#38322;?#29785;?#27996;嗭紝libc++/libstdc++,?#32342;涓釜?#31793;鏈夊叧绯?#37722;?#38171;?#37832;?#37510;?#28051;釜?#20824;鏄疌++鏍?#37713;嗗簱銆俵ibc++鏄拡瀵筩lang缂?#29831;戝櫒?#22738;鍒?#38322;?#37712;?#37928;凜++鏍?#37713;嗗簱?#32029;閭libstdc++?#22172;鐒跺氨鏄痝cc鐨?#27996;嬪浜嗐俵ibstdc++涓巊cc鐨勫叧绯诲氨鍍廲lang涓巐ibc++. ?#21502;?#33105;鐨勫尯鍒繖?#22135;涓?#28003;?#29831;?#32513;?#28000;?#32513;?#27996;嗐?/p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">鍐嶈璇磍ibstdc++?#32029;glibc鐨勫叧绯?#37510;?libstdc++涓巊cc鏄?#37817;?#32513;?#37734;竴?#25443;鐨勶紝?#31683;灏?#37828;?#29831;?#28729;夎?#21336;cc鐨勬?#36346;欎細?#22968;libstdc++瑁?#28051;?#37510;?閭?#28051;?#28000;?#31646;glibc?#25328;gcc?#30149;鏈夋崋缁?#37734;竴?#25443;鍛?#38171;?br style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; word-wrap: break-word;" />鐩?#23011;攇libc?#32029;libstdc++铏?#37906;舵?#24874;緵浜哻++绋嬪簭鐨勬爣鍑嗗簱?#32029;浣嗗?#20904;苟涓?#28051;?#37712;?#37837;?#37813;?#27996;?#38316;?#37510;?#28725;?#27996;?#32495;荤粺绾?#37714;?#37928;?#27996;嬩欢?#32029;libstdc++棣栧厛鏄細涓巊libc浜?#27996;紝鎵嶈兘?#25328;鍐?#37837;?#38315;氫俊銆?#37929;?#23011;攇libc鏉?#29831;达紝libstdc++灏?#37828;?#23536;楁病閭箞鍩虹浜嗐?/p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">璇?#28729;?#27996;嗚繖浜涘簱?#32029;?#32342;浜涘簱鏈缁堥兘鏄嬁鏉?#39582;?#37730;?#37928;?#38171;熷綋?#21159;鏄?#29781;佸?#21975;畠浠?#28051;庝綘鐨勭?#23338;簭閾炬帴鍦竴?#25443;锛?杩欐?#36346;欏氨涓?#23536;?#28051;嶈璇磄cc浜??#32139;?#21159;杩?#37832;夊墠鏂囨彁鍒?#37928;刢lang浠?#37721;妉lvm绛夌紪璇戝櫒?#32029;鏈?#37826;囧氨涓?#32513;?#29831;?#28729;?#28000;?#37928;勫尯鍒?#27996;?銆?/p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">浣?#37712;?#37928;凜浠爜.c鏂囦欢閫?#26473;gcc棣栧?#22563;{鍖?#28051;烘眹缂?S鏂囦欢?#32029;涔嬪?#24226;眹缂栧櫒as灏?S鏂囦欢杞?#37718;?#28051;?#37832;哄櫒浠爜.o鏂囦欢?#32029;鐢熸垚鐨?o鏂囦欢鍐?#28051;庡叾瀹?o鏂囦欢?#32029;鎴栬?#28052;嬪?#23942;彁鍒?#37928;刲ibc.so.6?#31793;鏂囦欢閫?#26473;ld閾炬帴?#27346;閾炬帴鍦竴鍧?#37922;熸?#24876;彲鎵?#29723;?#37826;囦欢銆傚綋鐒讹紝鍦?#28003;?#32514;?#29831;?#28000;?#37934;佷娇鐢gcc鐨勬?#36346;欙紝gcc?#25057;浠?#23480;?#32513;?#29999;?#28003;犳妸?#32342;浜涚粏鑺傚叏閮?#37707;氬浜嗐?/p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">閭g++鏄?#37707;?#28000;?#31646;鐨? 鎱?#37809;?#29831;?#37833;紝涓嶈浠?#28051;篻cc鍙兘缂?#29831;C浠爜?#32029;g++鍙兘缂?#29831;c++浠爜銆?鍚?#32514;涓?c鐨勶紝gcc?#22968;瀹冨綋浣?#37828;疌绋嬪簭?#32029;鑰実++?#32139;浣?#37828;痗++绋嬪簭锛涘悗缂涓?cpp鐨勶紝涓?#38000;呴兘?#32048;璁?#28051;?#37828;痗++绋嬪簭?#32029;娉剰?#32029;铏界劧c++鏄痗鐨勮?#21620;?#21997;紝浣嗘槸涓?#38000;?#28725;?#29831;?#23049;?#37928;勮?#20345;眰鏄?#37832;夊尯鍒?#37928;?#37510;?#37734;?#32514;?#29831;戦?#33333;?#30857;紝g++?#32048;璋?#37922;gcc,瀵?#27996;c++浠爜?#32029;涓?#38000;?#37828;?#32475;?#28000;?#37928;勶紝浣嗘槸鍥?#28051;篻cc?#25057;浠?#28051;嶈兘?#22172;鍔拰C++绋嬪簭?#23047;鐢?#37928;?#25652;撹?#26048;帴?#32029;?#28214;瑕佽?#27408;牱?#32029;gcc -lstdc++, 鎵浠?#28641;?#37835;?#28003;?#37928;凪akefile鏂囦欢骞舵病鏈?#37813;嬪姩鍔?#28051;妉ibstdc++?#31793;?#32029;?#31476;鑸?#28751;变細鎻愮?#27946;敊璇紝瑕佹眰浣?#28729;夎?#21336;++缂?#29831;戝櫒浜嗐?/p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">濂?#27996;嗭紝灏?#29831;村埌?#32342;?#32029;鐞嗘竻?#32342;浜涘簱涓?#32514;?#29831;戝櫒涔嬮棿鐨勫叧绯紝鐩俊浼氬?#36891;綘瑙?#37712;?#32514;?#29831;?#38334;炬帴杩囩?#23337;腑閬?#37714;?#37928;勯敊璇捣鍒颁竴?#20579;甯?#37716;?#37510;?/p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">濡?#37835;?#28003;?#37928;勭紪璇戝櫒涓嶆敮鎸佷竴浜?#37826;?#37928;凜/C++?#22738;鎬紝?#20802;鍗?#32510;gcc/g++, ?#32342;?#22135;?#31683;缁欏嚭?#31476;?#37340;鍩?#27996;巙buntu绯荤粺鐨?#37721;傝?#37826;?#23049;?#37510;?/p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">娣?#37716;ppa</p><pre style="box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 24px; padding: 8px; position: relative; font-family: consolas, Menlo, 'PingFang SC', 'Microsoft YaHei', monospace; white-space: pre-wrap; word-wrap: break-word; overflow: auto; font-size: 13px; line-height: 1.6; color: #4d4d4c; text-align: justify; background-color: #f7f7f7;"><code cs"="" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 8px; font-family: consolas, Menlo, 'PingFang SC', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; color: #383a42; background-image: none; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; line-height: 22px; white-space: pre; word-wrap: break-word; font-size: 14px; background-position: initial initial; background-repeat: initial initial;">sudo <span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #a626a4; word-wrap: break-word;">add</span>-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-<span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #a626a4; word-wrap: break-word;">get</span> update </code></pre><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">娣?#37716;ppa?#32029;鏄?#37733;?#28051;?#28003;?#37813;鐢?#37928;剈buntu?#22679;鏈?#37928;勬洿鏂?#23143;愪腑?#24434;?#20824;骞舵病鏈変綘?#20802;瑕?#37928;gcc/g++?#22679;鏈?#37510;?/p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">瀹夎鏂扮増gcc/g++</p><pre style="box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 24px; padding: 8px; position: relative; font-family: consolas, Menlo, 'PingFang SC', 'Microsoft YaHei', monospace; white-space: pre-wrap; word-wrap: break-word; overflow: auto; font-size: 13px; line-height: 1.6; color: #4d4d4c; text-align: justify; background-color: #f7f7f7;"><code sql"="" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 8px; font-family: consolas, Menlo, 'PingFang SC', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; color: #383a42; background-image: none; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; line-height: 22px; white-space: pre; word-wrap: break-word; font-size: 14px; background-position: initial initial; background-repeat: initial initial;">sudo apt-get <span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #a626a4; word-wrap: break-word;">install</span> gcc<span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #986801; word-wrap: break-word;">-4.8</span> sudo apt-<span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #a626a4; word-wrap: break-word;">get</span> <span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #a626a4; word-wrap: break-word;">install</span> g++<span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #986801; word-wrap: break-word;">-4.8</span> </code></pre><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">?#24434;浠?#37714;?usr/bin/gcc?#29025;?#28229;鏂?#28729;夎鐨gcc,g++</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">?#21412;缃?#32495;荤粺gcc/g++</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">?#23047;鐢update-alternatives,缁熶竴?#27967;鏂gcc/g++</p><pre style="box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 24px; padding: 8px; position: relative; font-family: consolas, Menlo, 'PingFang SC', 'Microsoft YaHei', monospace; white-space: pre-wrap; word-wrap: break-word; overflow: auto; font-size: 13px; line-height: 1.6; color: #4d4d4c; text-align: justify; background-color: #f7f7f7;"><code sql"="" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 8px; font-family: consolas, Menlo, 'PingFang SC', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; color: #383a42; background-image: none; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; line-height: 22px; white-space: pre; word-wrap: break-word; font-size: 14px; background-position: initial initial; background-repeat: initial initial;">sudo <span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #a626a4; word-wrap: break-word;">update</span>-alternatives <span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #a0a1a7; font-style: italic; word-wrap: break-word;">--install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6</span> sudo <span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #a626a4; word-wrap: break-word;">update</span>-alternatives <span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #a0a1a7; font-style: italic; word-wrap: break-word;">--install /usr/bin/gcc gcc /usr/bin/gcc-4.8 80 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8</span> sudo <span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #a626a4; word-wrap: break-word;">update</span>-alternatives <span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #a0a1a7; font-style: italic; word-wrap: break-word;">--config gcc</span> </code></pre><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">鏁板瓧浼?#37711;?#32510;?濡?0?#32029;80)?#29678;鐨勪細琚?#32495;荤粺閫夋嫨涓?#27035;?#29825;?#37928;勭紪璇戝櫒,?#31683;?#24434;浠?#37813;?#29723;岀涓?#37833;懡浠?#28751;?#37828;?#37833;?#37813;嬪姩?#21412;缃?#32495;荤粺鐨gcc,姝?#28598;勬寜?#21454;鎻愮,閫夋嫨4.8?#22679;鏈?#37928;?#37719;冲彲銆?/p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Lato, 'PingFang SC', 'Microsoft YaHei', sans-serif; color: #555555; line-height: 28px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;">杞浇锛歨ttp://www.chongh.wiki/blog/2016/05/25/lib-compile-link/</p></div><img src ="http://www.9087120.com/prayer/aggbug/216301.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/prayer/" target="_blank">Prayer</a> 2019-03-18 14:27 <a href="http://www.9087120.com/prayer/archive/2019/03/18/216301.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>linux so 鍔?#37804;佸簱?#33105;?#21455;灞鍙?#38322;?琚?#29781;?#37929;?#38338;?#26864;?/title><link>http://www.9087120.com/prayer/archive/2019/03/13/216294.html</link><dc:creator>Prayer</dc:creator><author>Prayer</author><pubDate>Wed, 13 Mar 2019 08:19:00 GMT</pubDate><guid>http://www.9087120.com/prayer/archive/2019/03/13/216294.html</guid><wfw:comment>http://www.9087120.com/prayer/comments/216294.html</wfw:comment><comments>http://www.9087120.com/prayer/archive/2019/03/13/216294.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/prayer/comments/commentRss/216294.html</wfw:commentRss><trackback:ping>http://www.9087120.com/prayer/services/trackbacks/216294.html</trackback:ping><description><![CDATA[<h2>闂?#26864;樻?#24538;堪</h2><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; color: #333333; line-height: 26px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff; border: 0px;">鍥?#35120;?#23005;?#26864;橈紝鍓嶆?#22443;椂闂?#26916;?#37929;紑鍙戜腑?#32029;瀹幇浜嗕竴?#37340;鍔?#37804;佸簱?#32029;灏佽浜嗕竴浜?#37826;?#23049;?#37510;?#37906;跺悗鍩?#27996;庤繖?#37340;鍔?#37804;佸簱?#32029;瀹幇浜嗕竴?#37340;搴?#37922;?#32459;嬪簭銆傚簲鐢?#32459;嬪簭?#33105;鍚?#37832;夊叏灞鍙?#38322;A?#32029;鍔?#37804;佸簱?#33105;?#31683;鍚?#37832;夊叏灞鍙?#38322;A?#32029;?#32139;鎴?#29835;?#37922;?#37716;?#37804;佸簱?#33105;鍑?#37825;?#37722;庯紝鍙戠幇搴?#37922;?#32459;嬪簭鐨凙鍙?#37922;?#27996;嗗彉鍖?#38171;?#38171;?#38171;O?#32029;My God锛?#28725;?#27996;庢?#25123;繖绉嶈?#27195;病鍦Linux涓嬪仛杩囧紑鍙?#37928;?#27996;?#37833;?#29831;达紝?#31476;澶撮浘姘?#37510;?#37510;?#37510;?#37510;?#37510;?#37510;?浜?#37828;?#37812;戝皾璇曠潃?#32029;灏A?#33105;鐨?#37721;?#38322;?#37722;?#32457;版敼涓B?#32029;杩欐牱闂?#26864;樹篃灏辨病鏈?#27996;~~~</p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; color: #333333; line-height: 26px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff; border: 0px;"></p><h2><a name="t1" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: rgb(78, 161, 219); cursor: pointer; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; word-wrap: break-word;"></a>鍘?#37733;?/h2><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; font-size: 16px; color: #4f4f4f; line-height: 26px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff;"></p><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; color: #333333; line-height: 26px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff; border: 0px;">搴?#37922;?#32459;嬪?#24538;繘琛?#38334;炬帴鐨勬?#36346;欙紝鍔?#37804;佸簱?#33105;?#21455;灞鍙?#38322;?#28729;?#28052;紝灏嗕細琚?#25652;?#37922;?#32459;嬪簭?#33105;鍚?#37722;?#37928;勫叏灞鍙?#38322;?#37813;瑕?#37929;?#37510;傝?#27408;牱?#31683;灏?#38315;?#37812;?#27996;嗭紝鍦?#37716;?#37804;佸簱?#33105;淇?#37824;笰鍙?#38322;?#37827;讹紝搴?#37922;?#32459;嬪簭?#33105;鐨凙?#31683;鍙?#37922;?#27996;嗗彉鍖?#37510;?/p><h2><a name="t2" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: rgb(78, 161, 219); cursor: pointer; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; word-wrap: break-word;"></a>瑙?#37712;?#37826;?#23049;?/h2><p style="box-sizing: border-box; outline: 0px; margin: 0px 0px 16px; padding: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; color: #333333; line-height: 26px; overflow-x: auto; word-wrap: break-word; background-color: #ffffff; border: 0px;">鍦?#37714;涘缓鍔?#37804;?#38334;炬帴?#31793;鏃讹紝gcc/g++閫夐?#36891;腑娣?#37716;?#32514;?#29831;?#38315;夐</p><pre style="box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 24px; padding: 8px; position: relative; font-family: Consolas, Inconsolata, Courier, monospace; white-space: pre-wrap; word-wrap: break-word; overflow-x: auto; line-height: 22px; background-color: #ffffff;"><code hljs"="" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 8px; font-family: 'Source Code Pro', 'DejaVu Sans Mono', 'Ubuntu Mono', 'Anonymous Pro', 'Droid Sans Mono', Menlo, Monaco, Consolas, Inconsolata, Courier, monospace, 'PingFang SC', 'Microsoft YaHei', sans-serif; display: block; overflow-x: auto; color: #abb2bf; background-color: #282c34; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; white-space: pre; word-wrap: break-word;">-Wl,-Bsymbolic.</code></pre><br style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; word-wrap: break-word; color: #333333; font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif, SimHei, SimSun; background-color: #ffffff;" /><span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; word-wrap: break-word; color: #333333; background-color: #ffffff;">?#21502;?#33105;</span><span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; word-wrap: break-word; color: #333333; background-color: #ffffff; border-width: 0px;">Wl</span><span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; word-wrap: break-word; color: #333333; background-color: #ffffff;">琛?#32448;?#28751;嗙揣璺熷?#36346;悗鐨?#37721;?#37825;帮紝浼?#38315;?#32513;欒繛?#24116;?#27346;</span><span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; word-wrap: break-word; color: #333333; background-color: #ffffff; border-width: 0px;">ld<span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; word-wrap: break-word; border-width: 0px;">銆?/span>Bsymbolic</span><span style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; font-family: Helvetica, arial, freesans, clean, sans-serif; word-wrap: break-word; color: #333333; background-color: #ffffff;">琛?#32448;哄己鍒?#38322;?#37922;?#37832;?#37734;?#37928;勫叏灞鍙?#38322;?#28729;?#28052;紝杩欐牱灏?#28051;?#28028;氬嚭?#24135;鍔?#37804;?#38334;炬帴?#31793;鐨勫叏灞鍙?#38322;?#28729;?#28052;夎搴?#37922;?#32459;嬪簭鐨?#37722;?#37722;?#28729;?#28052;夌粰瑕?#37929;?#27996;?#38171;?/span><img src ="http://www.9087120.com/prayer/aggbug/216294.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/prayer/" target="_blank">Prayer</a> 2019-03-13 16:19 <a href="http://www.9087120.com/prayer/archive/2019/03/13/216294.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>GCC鐨勭鍙峰彲瑙?#37804;斺?#29785;?#37712;冲?#27691;釜?#31793;鍚?#37722;?#32471;?#37721;?#37712;茬?#20352;棶棰?/title><link>http://www.9087120.com/prayer/archive/2019/03/04/216284.html</link><dc:creator>Prayer</dc:creator><author>Prayer</author><pubDate>Mon, 04 Mar 2019 03:45:00 GMT</pubDate><guid>http://www.9087120.com/prayer/archive/2019/03/04/216284.html</guid><wfw:comment>http://www.9087120.com/prayer/comments/216284.html</wfw:comment><comments>http://www.9087120.com/prayer/archive/2019/03/04/216284.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/prayer/comments/commentRss/216284.html</wfw:commentRss><trackback:ping>http://www.9087120.com/prayer/services/trackbacks/216284.html</trackback:ping><description><![CDATA[     鎽?#29781;? 闂?#26864;?#37832;杩?#26916;?#37929;?#38316;?#37714;颁竴浜?#38338;?#26864;橈紝鍦烘櫙濡?#28051;嬩?#33636;?#23338;簭渚?#29863;?#27996;?#28051;釜?#31793;libA鐨刦uncA鍑?#37825;板拰libB鐨刦uncB鍑?#37825;?#37510;?#32448;烘剰鐨?#28000;爜(main.cpp)濡?#28051;?#38171;?include <cstdio> int funcA(int, int); int funcB(int, int); int main() { printf("%d,", funcA(2, 1)); printf("%d\n"...  <a href='http://www.9087120.com/prayer/archive/2019/03/04/216284.html'>闃?#29831;诲叏鏂?/a><img src ="http://www.9087120.com/prayer/aggbug/216284.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/prayer/" target="_blank">Prayer</a> 2019-03-04 11:45 <a href="http://www.9087120.com/prayer/archive/2019/03/04/216284.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>閾炬帴涓庤嚜瀹?#28052;夊嚱鏁?#37722;?#37722;?#37722;?#37928;勫簱鍑?#37825;?/title><link>http://www.9087120.com/prayer/archive/2019/03/04/216283.html</link><dc:creator>Prayer</dc:creator><author>Prayer</author><pubDate>Mon, 04 Mar 2019 03:37:00 GMT</pubDate><guid>http://www.9087120.com/prayer/archive/2019/03/04/216283.html</guid><wfw:comment>http://www.9087120.com/prayer/comments/216283.html</wfw:comment><comments>http://www.9087120.com/prayer/archive/2019/03/04/216283.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/prayer/comments/commentRss/216283.html</wfw:commentRss><trackback:ping>http://www.9087120.com/prayer/services/trackbacks/216283.html</trackback:ping><description><![CDATA[     鎽?#29781;? 閬?#37714;颁竴?#37340;闂?#26864;? 灏佽SQLite3鎴?#38344;欐佸簱?#32029;杩囩?#23337;腑鍙戠幇SQLite3鐨?#23143;愮爜鐨shell.c?#33105;鏈main鍑?#37825;?#38171;歩nt SQLITE_CDECL main(int argc, char **argv){ char *zErrMsg = 0; ShellState data; const char *zInitFile = 0; int i; int rc = 0; int wa...  <a href='http://www.9087120.com/prayer/archive/2019/03/04/216283.html'>闃?#29831;诲叏鏂?/a><img src ="http://www.9087120.com/prayer/aggbug/216283.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/prayer/" target="_blank">Prayer</a> 2019-03-04 11:37 <a href="http://www.9087120.com/prayer/archive/2019/03/04/216283.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>鍚剈nix骞?#37721;?#37716;?#37804;佽繛?#24116;?#31793;鐨勭紪璇?#28051;庝娇鐢?/title><link>http://www.9087120.com/prayer/archive/2019/03/01/216276.html</link><dc:creator>Prayer</dc:creator><author>Prayer</author><pubDate>Fri, 01 Mar 2019 09:58:00 GMT</pubDate><guid>http://www.9087120.com/prayer/archive/2019/03/01/216276.html</guid><wfw:comment>http://www.9087120.com/prayer/comments/216276.html</wfw:comment><comments>http://www.9087120.com/prayer/archive/2019/03/01/216276.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.9087120.com/prayer/comments/commentRss/216276.html</wfw:commentRss><trackback:ping>http://www.9087120.com/prayer/services/trackbacks/216276.html</trackback:ping><description><![CDATA[<div>http://blog.itpub.net/283313/viewspace-2139257/<br /><br /><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;">unix骞?#37721;?#28051;嬶紝鍔?#37804;佽繛?#24116;?#31793;鐨勪娇鐢?#37832;?#28051;?#32457;?#37826;瑰紡?#32029;link鏂瑰?#24531;拰dlopen鏂瑰紡銆傞渶瑕佽缃甃D_LIBRARY_PATH浣?#28051;烘煡鎵矾寰?#38171;?#28003;庣増鏈AIX?#23047;鐢LIBPATH锛?#37510;俵ink鏂瑰紡鏄?#32459;嬪簭鍚?#37716;?#37827;?#37716;犺浇鎵鏈夌紪璇?#37827;惰繛?#24116;鐨?#37716;?#37804;佸簱?#32029;鐩村?#25198;?#23338;簭?#31912;鏉熶篃涓?#28028;氬叧闂?#37510;俤lopen鏂瑰紡鏄?#37734;?#26473;愯?#23676;腑?#23516;?#21454;鍙?#37825;?#37816;?#28729;?#37928;?#37826;瑰紡鍔犺浇鍔?#37804;佸簱?#32029;骞跺彲浠娇鐢dlclose鍑?#37825;板叧闂紝鐩村埌涓嬫鍐嶄娇鐢dlopen閲?#37826;?#37716;犺浇銆傚洜姝紝link鏂瑰紡鏃?#23049;?#37707;氬埌涓?#38322;?#37722;?#25652;?#37922;?#32459;嬪?#24538;屾洿鏂?#37716;?#37804;佸簱?#22679;鏈紝dlopen鏂瑰?#24531;彲浠?#37510;?/p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;">鍚?#39582;?#37721;?#37716;?#37804;佽繛?#24116;?#31793;鐨勭紪璇?#37721;?#37825;板涓?#37510;?#37826;囦欢wel.c?#32029;缂?#29831;?#37812;libwel.so锛圚PUX涓簂ibwel.sl锛?#37510;?/p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"></p><div id="codeText" style="margin: 0px 0px 1.1em; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: Consolas, monospace; border: 1px solid #dddddd; width: 872.1875px; overflow: auto; word-break: break-all; background-color: #ffffff; font-size: 12px; line-height: normal; color: #444444;"><ol start="1" style="margin: 0px 1px 0px 0px; padding: 0px 0px 0px 40px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; list-style: disc; color: #5c5c5c; line-height: 1.3;"><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><span style="color: #000000;">#include <span style="color: #0000cc;"><</span>stdio<span style="color: #0000cc;">.</span>h<span style="color: #0000cc;">></span><br /></span></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">void welcome<span style="color: #0000cc;">(</span>void<span style="color: #0000cc;">)</span><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><span style="color: #0000cc;">{</span><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">    puts<span style="color: #0000cc;">(</span><span style="color: #ff00ff;">"welcome,baby!"</span><span style="color: #0000cc;">)</span><span style="color: #0000cc;">;</span><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><span style="color: #0000cc;">}</span></li></ol></div><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /> linux:<br />  缂?#29831;libwel.so:<br />   gcc -fPIC -shared -o libwel.so wel.c -lc<br />    -fPIC  鐢?#37929;?#28725;?#37734;板潃瀹?#28003;?br />    -shared  鐢熸垚鍔?#37804;佽繛?#24116;?#31793;</p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"> sco unix open server:<br />  缂?#29831;libwel.so:<br />   cc -K PIC -G -o libwel.so wel.c -lc<br />    -K PIC  鐢?#37929;?#28725;?#37734;板潃瀹?#28003;?br />    -G  鐢熸垚鍔?#37804;佽繛?#24116;?#31793;?#32029;?#23512;鍚?#27996;?b elf閫夐</p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"> AIX:<br />  缂?#29831;libwel.so:<br />   xlc -G -bnoentry -o libwel.so wel.c -lc<br />    -G  鎸?#28729;?#37922;熸垚鍔?#37804;佽繛?#24116;?#31793;<br />    -bnoentry 鍔?#37804;佸簱鏃犻渶妯?#37735;?#37711;?#37721;?#38171;?#28003;庣増鏈AIX?#28214;瑕?#23005;?#37721;?#37825;?#38171;?/p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"> HP UX:<br />  缂?#29831;libwel.so:<br />   cc +z -c wel.c<br />   ld -b -o libwel.sl wel.o -lc<br />    +z  鐢?#37929;?#28725;?#37734;板潃瀹?#28003;?br />    -b  鐢熸垚鍔?#37804;佽繛?#24116;?#31793;</p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"> SUN OS: 寰堢被浼糞CO?#32029;man甯?#37716;?#28051;嶅叏闈?br />  缂?#29831;libwel.so:<br />   cc -G -o libwel.so wel.c -lc<br />    -G  鐢熸垚鍔?#37804;佽繛?#24116;?#31793;</p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;">link鏂瑰紡?#23047;鐢?#37716;?#37804;佽繛?#24116;?#31793;鐨勭紪璇?#37721;?#37825;板涓?#37510;?#37826;囦欢welcome.c?#32029;缂?#29831;?#37812;welcome?#24434;鎵?#29723;岀?#23338;簭銆?/p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"></p><div id="codeText" style="margin: 0px 0px 1.1em; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: Consolas, monospace; border: 1px solid #dddddd; width: 872.1875px; overflow: auto; word-break: break-all; background-color: #ffffff; font-size: 12px; line-height: normal; color: #444444;"><ol start="1" style="margin: 0px 1px 0px 0px; padding: 0px 0px 0px 40px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; list-style: disc; color: #5c5c5c; line-height: 1.3;"><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><span style="color: #000000;">extern void welcome<span style="color: #0000cc;">(</span>void<span style="color: #0000cc;">)</span><span style="color: #0000cc;">;</span><br /></span></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><span style="color: #ff0000;">int</span> main<span style="color: #0000cc;">(</span>void<span style="color: #0000cc;">)</span><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><span style="color: #0000cc;">{</span><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">        welcome<span style="color: #0000cc;">(</span><span style="color: #0000cc;">)</span><span style="color: #0000cc;">;</span><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">        return 0<span style="color: #0000cc;">;</span><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><span style="color: #0000cc;">}</span></li></ol></div><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"> linux:<br />   gcc -rdynamic -o welcome welcome.c -L. -lwel<br />    -rdynamic  瀵煎嚭鎵鏈夌鍙蜂緵鍔?#37804;佷娇鐢?/p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"> sco unix open server:<br />   cc -b elf -o welcome welcome.c -L. -lwel<br />    -b elf  ?#32320;椤讳娇鐢ELF鐨勫彲鎵?#29723;?#37826;囦欢鏍煎紡</p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"> AIX:<br />   xlc -bdynamic -brtl -o welcome welcome.c -L. -lwel<br />    -bdynamic ?#23047;鐢?#37716;?#37804;佽繛?#24116;鏂瑰紡?#32029;绯荤粺榛?#29825;?#28051;?#23005;?#37826;瑰紡<br />    -brtl  -l鍙?#37825;颁娇鐢?so涓哄簱</p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"> HP UX:<br />   cc -dynamic -o welcome welcome.c -L. -lwel<br />    -dynamic ?#23047;鐢?#37716;?#37804;佽繛?#24116;鏂瑰紡?#32029;绯荤粺榛?#29825;?#28051;?#23005;?#37826;瑰紡</p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"> SUN OS:<br />  缂?#29831;libwel.so:<br />   cc -B dynamic -o welcome welcome.c -L. -lwel<br />    -B dynamic ?#23047;鐢?#37716;?#37804;佽繛?#24116;鏂瑰紡</p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;">dlopen鏂瑰紡?#32029;?#21502;瀹?#28751;?#37828;妸鎵撳紑鍔?#37804;佸簱鍜屾煡鎵剧鍙?#37928;?#37716;?#28003;滄斁鍦?#32459;嬪簭?#33105;鎵?#29723;?#37510;傚洜姝?#32514;?#29831;戝彲鎵?#29723;?#37826;囦欢涓庢櫘閫?#37928;勭浉鍚岋紝鍙?#29781;佽繛?#24116;libdl.so?#31793;鍗冲彲銆?#37826;囦欢welcome.c?#32029;缂?#29831;?#37812;welcome?#24434;鎵?#29723;岀?#23338;簭銆?/p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"></p><div id="codeText" style="margin: 0px 0px 1.1em; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: Consolas, monospace; border: 1px solid #dddddd; width: 872.1875px; overflow: auto; word-break: break-all; background-color: #ffffff; font-size: 12px; line-height: normal; color: #444444;"><ol start="1" style="margin: 0px 1px 0px 0px; padding: 0px 0px 0px 40px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; list-style: disc; color: #5c5c5c; line-height: 1.3;"><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><span style="color: #000000;">#include <span style="color: #0000cc;"><</span>dlfcn<span style="color: #0000cc;">.</span>h<span style="color: #0000cc;">></span><br /></span></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><span style="color: #ff0000;">int</span> main<span style="color: #0000cc;">(</span>void<span style="color: #0000cc;">)</span><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><span style="color: #0000cc;">{</span><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">    void <span style="color: #0000cc;">*</span>handle<span style="color: #0000cc;">;</span><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">    void <span style="color: #0000cc;">(</span><span style="color: #0000cc;">*</span>welcome<span style="color: #0000cc;">)</span><span style="color: #0000cc;">(</span>void<span style="color: #0000cc;">)</span><span style="color: #0000cc;">;</span><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">    handle<span style="color: #0000cc;">=</span>dlopen<span style="color: #0000cc;">(</span><span style="color: #ff00ff;">"libwel.so"</span><span style="color: #0000cc;">,</span>RTLD_LAZY<span style="color: #0000cc;">)</span><span style="color: #0000cc;">;</span><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">    welcome<span style="color: #0000cc;">=</span>dlsym<span style="color: #0000cc;">(</span>handle<span style="color: #0000cc;">,</span><span style="color: #ff00ff;">"welcome"</span><span style="color: #0000cc;">)</span><span style="color: #0000cc;">;</span><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">    <span style="color: #0000cc;">(</span><span style="color: #0000cc;">*</span>welcome<span style="color: #0000cc;">)</span><span style="color: #0000cc;">(</span><span style="color: #0000cc;">)</span><span style="color: #0000cc;">;</span><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);">    return 0<span style="color: #0000cc;">;</span><br /></li><li style="margin: 0px; padding: 0px 0px 0px 10px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><span style="color: #0000cc;">}</span></li></ol></div><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /> linux:<br />   gcc -rdynamic -o welcome welcome.c -ldl<br />    -rdynamic 瀵煎嚭鎵鏈夌鍙蜂緵鍔?#37804;佷娇鐢?br />    -ldl  鐢?#32495;荤粺libdl.so?#31793;dlopen(),dlsym(),dlerror(),dlclose()</p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"> sco unix open server:<br />   cc -b elf -o welcome welcome.c -lc<br />    -b elf  浠elf鏍煎紡?#32029;鍔?#37804;佽繛?#24116;?#31793;?#32320;椤?/p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"> AIX:<br />   xlc -bexpall -o welcome welcome.c -ldl -lc<br />    -bexpall ?#23047;涓荤?#23338;簭鐨勭鍙峰彲浠?#29722;?#37716;?#37804;佸簱?#23047;鐢?/p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"> HP UX:<br />   cc -o welcome welcome.c -ldl -lc</p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"> SUN OS:<br />   cc -o welcome welcome.c -ldl -lc</p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;">------------------------------------------------------------------------------<br />鍙傜収鐨刴an鎵嬪唽锛?br /> cc, ld, ldd, dlopen, dlclose, dlerror, dlsym, CC</p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;">鍙?#38171;AIX杩愯鍔?#37804;佸簱鏃?#28028;氬姞?#27975;绯荤粺鍐呭瓨缁熶竴绠?#37918;嗭紝瀵?#38007;?#37719;充娇绋嬪簭宸?#38315;?#22189;?#32029;缂?#29831;?#37827;?#28000;嶇劧璁?#28051;?#26473;?#37734;娇鐢?#38000;?#37827;?#23049;?#29781;?#37929;?#37510;?#37832;?#28051;釜鍔?#23049;曪紝?#31476;鏄痳oot鐢埛鎵?#29723;slibclean?#32029;?#31483;鐞?#32495;荤粺鍔?#26462;借?#37827;?#27996;轰娇鐢?#37928;?#37716;?#37804;佸簱?#32029;鍙竴绉?#37828;?#32514;?#29831;?#37928;勫簱chmod go-rwx?#32029;?#23047;寰?#32513;勫?#23677;叾浠?#27996;?#37827;?#37833;?#38340;愶紝?#32342;绉嶅簱绯荤粺?#32048;璁?#28051;?#37922;埛?#22738;鏈夎?#28051;?#37716;犺浇銆?/p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; line-height: 28px; font-size: 16px; color: #666666; text-align: justify; background-color: #ffffff;"><br /></p><p style="margin: 0px 0px 18px; padding: 0px; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); font-family: -apple-system, 'SF UI Text', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'WenQuanYi Micro Hei', sans-serif; color: #666666; font-size: 16px; line-height: 28px; text-align: justify; background-color: #ffffff;">鏉嚜 “ ITPUB鍗氬 ” ?#32029;閾炬帴锛歨ttp://blog.itpub.net/283313/viewspace-2139257/?#32029;濡傞渶杞浇?#32029;璇?#23049;?#37828;庡嚭澶勶紝鍚?#37714;欏皢杩界?#33333;硶寰嬭浠?#37510;?/p></div><img src ="http://www.9087120.com/prayer/aggbug/216276.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.9087120.com/prayer/" target="_blank">Prayer</a> 2019-03-01 17:58 <a href="http://www.9087120.com/prayer/archive/2019/03/01/216276.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣璇勮</a></div>]]></description></item><item><title>shell鑴?#37832;姤?#25930;"[: =: unary operator expected"鐨勮鍐?#37826;规http://www.9087120.com/prayer/archive/2019/03/01/216275.htmlPrayerPrayerFri, 01 Mar 2019 07:20:00 GMThttp://www.9087120.com/prayer/archive/2019/03/01/216275.htmlhttp://www.9087120.com/prayer/comments/216275.htmlhttp://www.9087120.com/prayer/archive/2019/03/01/216275.html#Feedback0http://www.9087120.com/prayer/comments/commentRss/216275.htmlhttp://www.9087120.com/prayer/services/trackbacks/216275.html  鍦?#37718;归厤瀛?#32471;?#28051;?#37929;哥瓑鏃讹紝鎴?#37922;?#27996;?#32491;?#28028;?#26473;欐牱鐨勮鍙?#38171;?/span>

if [ $STATUS == "OK" ]; then     

echo "OK"

fi

    鍦?#26473;愯鏃跺嚭?#24135;浜?#8220; [: =: unary operator expected” 鐨勯敊璇紝灏变竴?#27967;鎵?#28051;?#37714;板師鍥狅紝灏?#29831;?#27996;嗗闄?#32475;夊彿涓晶鐨勭鏍煎?#23678;嫭鍙烽噷鐨勭鏍兘涓嶇鐢?#37510;?#37832;鍚?a href="https://www.baidu.com/s?wd=baidu&tn=24004469_oem_dg&rsv_dl=gh_pl_sl_csd" target="_blank" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: #6795b5; text-decoration: none; cursor: pointer; word-wrap: break-word;">baidu浜嗕竴涓嬶紝鎵嶆壘鍒板師鍥狅紝鍦?#37833;欢琛?#26440;惧紡澶?#37712;嶆坊鍔犱竴?#30512;“[]”?#32029;灏?#28051;?#28028;氬嚭?#25930;浜嗭紝濡?#28051;?#38171;?/span>

if [[ $STATUS = "OK" ]]; then    

echo "OK"

fi 

    绌跺?#36346;師鍥狅紝鏄?#37733;?#28051;?#28641;?#37835;?#37721;?#38322;廠TATUS鍊?#28051;虹?#29492;紝閭箞鏉欢琛?#26440;惧紡灏?#37812;?#27996;?[ = "OK"] ?#32029;鏄剧劧 [ ?#25328; "OK" 涓?#37929;哥?#22794;苟涓旂己灏?#27996;?nbsp;[ 绗?#37721;凤紝鎵浠姤浜?#26473;欐牱鐨勯敊璇?#37510;傚綋?#21159;涓?#37804;绘槸?#22189;?#25930;?#32029;濡?#37835;?#37721;?#38322;廠TATUS鍊?#28051;?#28051;虹?#29492;紝绋嬪簭灏辨甯?#27996;嗭紝鎵浠?#26473;欐牱鐨勯敊璇?#26473;?#37828;?#23536;?#38341;愯斀鐨?#37510;?/span>

    鎴栬咃紝鐢?#28051;嬮潰鐨?#37826;?#23049;曚篃?#20824;閬?#37711;嶈繖绉嶉敊璇?#38171;?/span>

if [ "$STATUS"x == "OK"x ]; then     

echo

"OK"

fi銆?/span>

?#32139;鐒讹紝x?#31683;?#24434;浠?#37828;叾浠?#28699;?#32471;?#37510;?#26916;?#28186;?#37819;愪竴?#20579;?#32029;shell?#33105;鏈夋病鏈夊?#23677;紩鍙?#37734;?#23536;?#28598;氭儏鍐?#28051;?#37828;竴鑷?#37928;?#37510;?/span>

 

杞嚜锛?a href="http://hi.baidu.com/vishare/blog/item/bd8ab9ee289753252cf53417.html" rel="nofollow" target="_blank" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: #336699; text-decoration: none; cursor: pointer; word-wrap: break-word;">http://hi.baidu.com/vishare/blog/item/bd8ab9ee289753252cf53417.html



Prayer 2019-03-01 15:20 鍙戣璇勮
]]>
linux 闈欐佸簱鐨?#38334;炬帴 undefined referencehttp://www.9087120.com/prayer/archive/2019/02/28/216273.htmlPrayerPrayerThu, 28 Feb 2019 08:59:00 GMThttp://www.9087120.com/prayer/archive/2019/02/28/216273.htmlhttp://www.9087120.com/prayer/comments/216273.htmlhttp://www.9087120.com/prayer/archive/2019/02/28/216273.html#Feedback0http://www.9087120.com/prayer/comments/commentRss/216273.htmlhttp://www.9087120.com/prayer/services/trackbacks/216273.htmlhttps://blog.csdn.net/csdn66_2016/article/details/70145962
鏈杩?#37734;Linux涓?#32514;?#32459;嬪彂鐜颁竴?#37340;璇?#23534;?#37928;勭幇?#34180;?#32029;灏?#37828;?#37734;?#38334;炬帴?#31476;?#37340;闈欐佸簱鐨勬?#36346;欐绘槸?#23012;?#25930;?#32029;绫?#28028;?#28051;嬮潰杩欐牱鐨勯敊璇?#38171;?/span>
  1. (.text+0x13): undefined reference to `func' 

    ?#21479;浜巙ndefined reference杩欐牱鐨?#38338;?#26864;橈紝澶?#28729;跺叾瀹?#32513;?#29999;細閬?#37714;帮紝鍦?#23005;紝鎴?#28000;?#29831;?#32513;?#37734;扮渚?#32513;欏嚭甯?#29785;侀敊璇?#37928;?#37722;?#32457;嶅師鍥?#28000;?#37721;?#29785;?#37712;?#37826;?#23049;曪紝甯?#37832;?#28725;?#37714;?#28699;?#38000;?#37832;?#37813;甯?#37716;?#37510;?/p>

1.  閾炬帴鏃剁己澶?#27996;?#37929;稿叧鐩?#37837;?#37826;囦欢锛?o锛?/span>

    娴?#29831;?#28000;?#37934;佸涓?#38171;?/span>

 

    鐒跺悗缂?#29831;?#37510;?/p>

  1. gcc -c test.c  
  2. gcc –c main.c 

    寰?#37714;?#28051;釜 .o 鏂囦欢?#32029;?#31476;?#37340;鏄?main.o?#32029;?#31476;?#37340;鏄?test.o ?#32029;鐒跺?#24226;垜浠?#38334;炬帴 .o 寰?#37714;板彲鎵?#29723;岀?#23338;簭锛?/p>

  1. gcc -o main main.o 

    杩欐?#35769;紝浣犱?#27692;彂?#24135;?#32029;?#23012;?#25930;浜?#38171;?/p>

  1. main.o: In function `main':  
  2. main.c:(.text+0x7): undefined reference to `test'  
  3. collect2: ld returned 1 exit status 

    ?#32342;灏?#37828;?#37832;鍏稿瀷鐨剈ndefined reference?#25930;璇紝鍥?#28051;?#37734;?#38334;炬帴鏃?#37721;戠幇鎵?#28051;?#37714;版?#24874;釜鍑?#37825;?#37928;?#28729;幇鏂囦欢?#32029;鏈?#28186;嬩腑test.o鏂囦欢?#33105;?#23512;鍚?#27996;唗est()鍑?#37825;?#37928;?#28729;幇?#32029;鎵浠?#28641;?#37835;滄寜涓嬮潰?#32342;绉?#37826;瑰紡閾炬帴灏辨病浜?#27996;嗐?/p>

  1. gcc -o main main.o test.o 

   銆愭墿灞?#37510;?#38171;氬叾瀹?#28051;?#38344;?#28051;?#27996;?#29825;?#28598;?#28729;舵洿鍔犳竻妤氬?#26334;眰鍘?#37733;狅紝鎴戞妸缂?#29831;?#38334;炬帴鍒嗗紑浜嗭紝涓嬮潰杩欐牱缂?#29831;戜篃?#32048;?#23012;undefined reference?#25930;?#32029;?#21502;瀹?#25652;曞眰鍘?#37733;?#28051;庝笂闈?#37828;竴?#29297;鐨?#37510;?/p>

  1. gcc -o main main.c //?#24049;灏test()鐨?#28729;幇鏂囦欢 

?#28214;瑕佹?#35268;?#24876;涓嬪舰?#32033;鎵嶈兘鎴?#37716;燂紝灏唗est()鍑?#37825;?#37928;?#28729;幇鏂囦欢?#31476;?#25443;缂?#29831;?#37510;?/p>

  1. gcc -o main main.c test.c //ok,?#30149;闂?#26864;?#27996;?/span> 

2.    閾炬帴鏃剁己灏?#37929;稿叧鐨勫簱鏂囦欢锛?a/.so锛?/span>

    鍦?#23005;紝鍙?#28051;句釜闈欐佸簱鐨勪?#23338;瓙?#32029;鍋?#29825;?#23143;愮?#20344;涓?#37510;?/p>

    鍏堟妸test.c缂?#29831;?#37812;?#38344;欐佸簱(.a)鏂囦欢

  1. gcc -c test.c  
  2. ar -rc test.a test.o 

    鑷?#23005;紝鎴?#28000;?#23536;?#37714;?#27996;唗est.a鏂囦欢銆?#37812;?#28000;紑濮?#32514;?#29831;憁ain.c

  1. gcc -c main.c 

    杩欐?#35769;紝鍒?#37922;熸垚浜唌ain.o鏂囦欢?#32029;鐒跺?#24226;垜浠?#37712;?#38315;?#26473;囧涓嬪懡浠?#26473;?#29723;?#38334;炬帴甯?#37832;涘緱鍒板彲鎵?#29723;岀?#23338;簭銆?/p>

  1. gcc -o main main.o 

    浣犱?#27692;彂?#24135;?#32029;缂?#29831;戝櫒?#23012;?#25930;浜?#38171;?/p>

  1. /tmp/ccCPA13l.o: In function `main':  
  2. main.c:(.text+0x7): undefined reference to `test'  
  3. collect2: ld returned 1 exit status 

    鍏舵牴鏈?#37720;?#37733;犱篃鏄?#37813;?#28051;?#37714;test()鍑?#37825;?#37928;?#28729;幇鏂囦欢?#32029;鐢?#27996;?#29831;test()鍑?#37825;?#37928;?#28729;幇鍦test.a?#32342;?#37340;闈欐佸簱?#33105;鐨勶紝鏁?#37734;?#38334;炬帴鐨勬?#36346;欓渶瑕?#37734;?#37711;跺悗鍔?#37711;test.a?#32342;?#37340;?#31793;?#32029;閾炬帴?#25057;浠?#28103;?#37824;?#28051;?#28641;?#28051;嬪舰?#32033;鍗冲彲銆?/p>

  1. gcc -o main main.o ./test.a  //娉?#38171;?/ 鏄?#32513;欏嚭浜唗est.a鐨勮矾寰?/span> 

     銆愭墿灞?#37510;?#38171;氬?#23678;牱?#32029;涓?#27996;嗘妸闂?#26864;?#29831;存竻妤氾紝涓?#38344;?#37812;?#28000;妸浠爜鐨勭紪璇?#38334;炬帴鍒嗗紑浜嗭紝濡?#37835;?#29999;?#37832;涗竴娆?#37804;?#37922;熸?#24876;彲鎵?#29723;岀?#23338;簭?#32029;鍒欏彲浠?#28725;筸ain.c?#25328;test.a鎵?#29723;屽涓嬪懡浠?#37510;?/p>

  1. gcc -o main main.c ./test.a  //鍚屾牱?#32029;濡?#37835;?#28051;?#37716;爐est.a?#31683;?#32048;?#23012;?#25930; 

3.    閾炬帴鐨勫簱鏂囦欢?#33105;鍙堜娇鐢?#27996;嗗彟?#31476;?#37340;?#31793;鏂囦欢

    ?#32342;绉?#38338;?#26864;樻?#26055;緝闅愯斀?#32029;?#31683;鏄?#37812;?#37832;杩?#38316;?#37714;?#37928;?#28051;?#32515;?#28051;?#28598;?#28729;惰璁?#37928;?#28051;?#37722;?#37928;?#38338;?#26864;橈紝涓?#28186;?#29831;?#37828;?#28641;?#28051;嬶紝棣栧?#22572;紝杩?#37828;湅?#28229;娴?#29831;?#28000;爜銆?/p>

    浠庝笂?#27992;?#24434;浠?#37930;嬪嚭?#32029;main.c璋?#37922;?#27996;唗est.c鐨?#37713;?#37825;帮紝test.c?#33105;鍙?#29835;?#37922;?#27996;唂un.c鐨?#37713;?#37825;?#37510;?br style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; word-wrap: break-word;" />    棣栧?#22572;紝鎴?#28000;?#37711;?#28725;筬un.c?#32029;test.c?#32029;main.c杩?#29723;?#32514;?#29831;戯紝鐢熸垚 .o鏂囦欢銆?/p>

  1. gcc -c func.c  
  2. gcc -c test.c  
  3. gcc -c main.c 

    鐒跺?#24239;紝灏唗est.c?#25328;func.c鍚勮嚜鎵撳寘鎴?#28051;?#38344;欐佸簱鏂囦欢銆?/p>

  1. ar –rc func.a func.o  
  2. ar –rc test.a test.o 

    杩欐?#35769;紝鎴?#28000;?#37713;嗗?#22247;皢main.o閾炬帴涓哄彲鎵?#29723;岀?#23338;簭?#32029;鐢?#27996;庢垜浠?#37928;刴ain.c?#33105;?#23512;鍚?#27996;?#28725;箃est()鐨勮皟鐢紝鍥?#23005;紝搴?#29831;?#37734;?#38334;炬帴鏃跺皢test.a浣?#28051;?#37812;?#28000;?#37928;勫簱鏂囦欢?#32029;閾炬帴?#25057;浠?#28641;?#28051;?#37510;?/p>

  1. gcc -o main main.o test.a 

    杩欐?#35769;紝缂?#29831;戝櫒浠?#37906;朵細?#23012;?#25930;?#32029;濡?#28051;?#38171;?/p>

  1. test.a(test.o): In function `test':  
  2. test.c:(.text+0x13): undefined reference to `func'  
  3. collect2: ld returned 1 exit status 

    灏?#37828;?#29831;达紝閾炬帴鐨勬?#36346;欙紝鍙戠幇鎴?#28000;?#37928;則est.a璋?#37922;?#27996;唂unc()鍑?#37825;帮紝鎵?#28051;?#37714;?#28725;?#25652;?#37928;?#28729;幇銆?#37922;辨鎴?#28000;?#37721;戠幇?#32029;鍘?#37833;?#37812;?#28000;?#26473;橀渶瑕佸皢test.a鎵寮?#37922;?#37714;?#37928;勫簱鏂囦欢?#31683;鍔?#26473;?#37833;?#37813;嶈兘鎴?#37716;?#38334;炬帴?#32029;鍥?#23005;懡浠?#28641;?#28051;?#37510;?/p>

  1. gcc -o main main.o test.a func.a 

    ok?#32029;杩欐牱灏卞彲浠?#37812;?#37716;?#23536;?#37714;?#37832;缁?#37928;勭?#23338;簭浜嗐傚?#23678;牱?#32029;濡?#37835;滄垜浠?#37928;勫簱鎴栬?#32459;嬪簭?#33105;寮?#37922;?#27996;?#32471;?#28051;?#37826;瑰簱锛堝?#20475;thread.a锛夊垯鍚屾牱鍦?#38334;炬帴鐨勬?#36346;欓渶瑕?#32513;欏嚭绗?#28051;?#37826;瑰簱鐨勮矾寰勫?#23677;簱鏂囦欢?#32029;鍚?#37714;欏氨浼氬緱鍒皍ndefined reference鐨勯敊璇?#37510;?/p>

4 澶氫釜?#31793;鏂囦欢閾炬帴椤?#25652;?#38338;?#26864;?/span>

    ?#32342;绉?#38338;?#26864;樹篃闈?#29999;?#37928;?#38341;愯斀?#32029;涓?#28000;?#32513;?#37934;旂?#26421;綘?#24434;?#20824;?#32048;鎰?#37714;?#38344;?#29999;?#37734;?a href="https://www.baidu.com/s?wd=%E8%8E%AB%E5%90%8D%E5%85%B6%E5%A6%99&tn=24004469_oem_dg&rsv_dl=gh_pl_sl_csd" target="_blank" style="box-sizing: border-box; outline: 0px; margin: 0px; padding: 0px; color: #6795b5; text-decoration: none; cursor: pointer; font-family: 'Microsoft YaHei', 'SF Pro Display', Roboto, Noto, Arial, 'PingFang SC', sans-serif; word-wrap: break-word;">鑾?#37722;嶅?#36346;銆?#37812;?#28000;?#28186;劧鍥?#37714;扮3灏忚妭鎵璁?#29825;?#37928;?#38338;?#26864;樹腑?#32029;鍦?#37832;鍚庯紝濡?#37835;滄垜浠妸閾炬帴鐨勫簱鐨?#26916;?#25652;?#37817;竴涓嬶紝?#28229;鐪嬩?#27692;彂鐢?#28000;?#31646;?#31912;鏋?#38171;?/p>

  1. gcc -o main main.o func.a test.a 

    鎴?#28000;?#28028;氬緱鍒板涓嬫姤?#25930;.

  1. test.a(test.o): In function `test':  
  2. test.c:(.text+0x13): undefined reference to `func'  
  3. collect2: ld returned 1 exit status 

    鍥?#23005;紝鎴?#28000;渶瑕?#23049;剰?#32029;鍦?#38334;炬帴?#25057;浠腑缁欏嚭鎵渚?#29863;?#37928;勫簱鏃讹紝?#28214;瑕?#23049;?#37808;忓簱涔嬮棿鐨勪緷璧?#26916;?#25652;忥紝渚?#29863;栧叾浠栧簱鐨勫簱?#31476;瀹?#29781;佹斁鍒?#29722;?#28186;?#29863;栧簱鐨勫墠闈紝杩欐牱鎵嶈兘鐪熸閬垮厤undefined reference鐨勯敊璇紝瀹屾?#24878;紪璇?#38334;炬帴銆?/p>

5. 鍦c++浠?#37934;佷腑閾炬帴c璇言鐨勫簱

    濡?#37835;?#28003;?#37928;勫簱鏂囦欢鐢c浠爜鐢熸垚鐨勶紝鍒?#37734;c++浠?#37934;佷腑閾炬帴?#31793;?#33105;鐨?#37713;?#37825;?#37827;讹紝?#31683;?#32048;纰?#37714;皍ndefined reference鐨?#38338;?#26864;?#37510;?#28051;嬮潰涓?#28186;?#29831;?#37828;?#37510;?/p>

    棣栧?#22572;紝缂?#37712;檆璇言鐗堝簱鏂囦欢锛?nbsp;

    

    缂?#29831;戯紝鎵撳寘涓?#38344;欐佸簱锛歵est.a

  1. gcc -c test.c  
  2. ar -rc test.a test.o 

    鑷?#23005;紝鎴?#28000;?#23536;?#37714;?#27996;唗est.a鏂囦欢銆?#28051;嬮潰鎴?#28000;紑濮?#32514;?#37712;檆++鏂囦欢main.cpp

    

    鐒跺悗缂?#29831;憁ain.cpp鐢熸?#24876;彲鎵?#29723;岀?#23338;簭锛?/p>

  1. g++ -o main main.cpp test.a 

    浼氬彂?#24135;?#23012;?#25930;锛?/p>

  1. /tmp/ccJjiCoS.o: In function `main': 
  2. main.cpp:(.text+0x7): undefined reference to `test()' 
  3. collect2: ld returned 1 exit status 

    鍘?#37733;?#28751;?#37828;main.cpp涓篶++浠爜?#32029;璋?#37922;?#27996;哻璇言?#31793;鐨?#37713;?#37825;帮紝鍥?#23005;?#38334;炬帴鐨勬?#36346;欐壘涓?#37714;帮紝瑙?#37712;?#37826;?#23049;?#38171;?#37719;?#37734;main.cpp?#33105;?#32029;?#22968;涓c璇言?#31793;test.a鐩稿叧鐨?#28598;?#37826;囦欢?#23512;鍚?#23075;?#37716;犱竴?#37340;extern "C"鐨勫鏄?#37719;冲彲銆備?#23338;?#20646;紝淇?#37824;?#37722;?#37928;刴ain.cpp濡?#28051;?#38171;?/p>

    

  1. g++ -o main main.cpp test.a 

    鍐?#32514;?#29831;?#28028;氬彂?#24135;?#32029;闂?#26864;?#23480;?#32513;?#37812;?#37716;?#29785;?#37712;?#37510;?/p>

6.  鎬??#31912;

    ?#32139;鐒讹紝涓?#38344;?#37713;?#32457;?#37828;?#37812;?#37929;墠鍙戠幇鐨勬?#26055;?#20904;父瑙?#37928;剈ndefined reference?#25930;璇?#37928;?#37720;?#37733;犲拰瑙?#37712;?#37826;?#23049;曪紝?#24434;?#20824;?#31683;鏈夊叾浠?#37722;?#32457;嶅師鍥狅紝娆?#26473;?#28598;?#28729;?#37833;俊lujun.hust@gmail.com浜?#23092;侊紝瀵?#37832;?#37826;囨杩?#29723;岃鍏咃紝鏂?#38344;?#37826;?#37813;嬩滑瑙?#37712;?#28699;?#28052;?#26473;囩?#23337;腑閬?#37714;?#37928;?#37722;?#32457;?#38338;?#26864;?#37510;?/p>



Prayer 2019-02-28 16:59 鍙戣璇勮
]]> տ3
<center id="iceyg"><tr id="iceyg"></tr></center>
<noscript id="iceyg"></noscript>
<center id="iceyg"></center>
<noscript id="iceyg"></noscript>
<noscript id="iceyg"></noscript>
<center id="iceyg"><tr id="iceyg"></tr></center>
<noscript id="iceyg"></noscript>
<center id="iceyg"></center>
<noscript id="iceyg"></noscript>
<noscript id="iceyg"></noscript>