linux϶¯Ì¬¿âÓ뾲̬¿â
ÌåÑéÒ»ÏÂlinuxϱàдºÍʹÓö¯Ì¬¿âÓ뾲̬¿â£¬·¶Àý£ºhelloworld³ÌÐò¡£
Ê×Ïȱàд¾²Ì¬¿â£º
hellos.h
#ifndef _HELLO_S_H
#define _HELLO_S_H
void prints(char *str);
#endif
hellos.c
#include "hellos.h"
#include <stdio.h>
void prints(char *str)
{
printf("print in static way:%s",str);
}
¿ªÊ¼±àÒë³É¾²Ì¬¿â£º
gcc -c -o hellos.o hellos.c
ar cqs libhellos.a hellos.o
main.c
#include "hellos.h"
int main(void)
{
char *text = "hello,world\n";
prints(text);
}
ʹÓþ²Ì¬¿â±àÒ룺gcc -o hello main.c -static -L. -lhellos
È»ºóÔËÐÐhello,Êä³ö£º
print in static way: Hello World!
ɾ³ý
libhellos.aºÍ
hellos.*ºó, ³ÌÐòÈÔÈ»Õý³£ÔËÐС£
±àд¶¯Ì¬¿â
£º
hellod.h
#ifndef _HELLO_D_H
#define _HELLO_D_H
void printd(char *str);
#endif
hellod.c
#include "hellod.h"
#include <stdio.h>
void printd(char *str)
{
printf("print in dynamic way:%s",str);
}
±àÒëÉú³É¶¯Ì¬¿â£ºgcc -shared -o libhellod.so hellod.c
ÕâÑù£¬libhellod.so¾ÍÊÇÉú³ÉµÄ¶¯Ì¬¿â¡£
export LD_LIBRARY_PATH=/root/program/link/dynamic/:$LD_LIBRARY_PATH£¬Ö¸¶¨¿âÎļþ·¾¶¡£
Èç¹ûϵͳװÁËSELINUXµÄ»°£¬ÒªÖ´ÐÐchcon -t textrel_shlib_t /root/program/link/dynamic/libhellod.so¸Ä±äȨÏÞ¡£
main.c
#include "hellod.h"
int main(void)
{
char *text = "hello,world\n";
printd(text);
}
gcc -o hello main.c -L./ -lhellod
È»ºóÔËÐÐhello¿ÉÒÔ¿´µ½Êä³ö
print in dynamic way: Hello World!
Èç¹ûɾ³ý¿âÎļþ£¬»á³öÏÖ£º./hello: error while loading shared libraries: libhellod.so: cannot open shared object file: No such file or directory
Ïà¹ØÎĵµ£º
sed ±à¼Ö¸ÁîµÄ¸ñʽÈçÏ :
sed option [address1[,address2]]function[argument] ***.c
λַ²ÎÊý address1/2 ΪÐÐÊý»òÆ¥Åä×Ö´® , ±íʾËùÖ´Ðб༵ÄÐÐ ;
º¯Êý²Î Êý function[argument] Ϊ sed µÄÄÚ¶¨º¯Êý , ±íʾִÐеı༶¯×÷¡£
Æ¥Åä×Ö´®£º£¨reguler expression ×Ö´®£©
& : ´ú±íÆäǰ pattern ×Ö´®
Àý£ºs ......
Ò»¡¢SHELL¼ò½é ¢ÙʲôÊÇSHELL ´ð£ºÒ»¸ö×÷ΪÓû§ÓëLINUXϵͳ֮¼äµÄ²Ù×÷½Ó¿Ú³ÌÐò£¬ÔÊÐíÓû§Ïò²Ù×÷ϵͳÊäÈëÐèÒªÖ´ÐеÄÃüÁî¡£
Ò»Öָ߼¶¡¢½âÊÍÐԵijÌÐòÓïÑÔ¡£ ¢ÚSHELLµÄÖÖÀà ¢ÛSHELLµÄÖ´ÐÐ
. ......
ÓÉÓÚLinux²»ÊÇÖйúÈË¿ª·¢µÄ£¬¿ª·¢¹ý³ÌÖÐÒ²²»ÊÇÒÔÖÐÎÄΪĸÓËäÓÐÖÐÎÄÓïÑÔ°ü£¬ÔÚÈí¼þ¼æÈÝÐÔÉϳöÏÖÖÐÎÄÂÒÂëÒ²ÔÚËùÄÑÃâ¡£ÎÒ³éÈ¡ÍøÂçÉÏǰÈ˵ľÑ飬½áºÏ×Ô¼ºµÄÀí½â£¬½«ËûÃǼÓÒÔ×ܽᣬϣÍû¶ÔºóÀ´ÕßÓÐËù°ïÖú¡£
1¡¢htmlÎļþÂÒÂ룻
&nbs ......
½ø³ÌÊdzÌÐòÖ´ÐÐʱµÄÒ»¸öʵÀý£¬Êdzä·ÖÃèÊö³ÌÐòÒѾִÐе½ºÎÖ̶ֳȵÄÊý¾Ý½á¹¹µÄ»ã¼¯¡£ÔÚlinuxÖУ¬³£½«½ø³Ì³ÆÎªÈÎÎñ£¨task£©»òÕßỊ̈߳¨thread£©¡£½ø³ÌµÄÄ¿µÄ¾ÍÊdzе£·ÖÅäϵͳ×ÊÔ´µÄʵÌå¡£
µ±Ò»¸ö½ø³Ì´´½¨Ê±£¬¼¸ºõÓ븸½ø³ÌÏàͬ¡£½ÓÊܸ¸½ø³ÌµØÖ·¿Õ¼äµÄÒ»¸öÂß¼¿½±´£¬²¢´Ó½ø³Ì´´½¨ÏµÍ³µ÷ÓõÄÏÂÒ»ÌõÖ¸ÁʼִÐÐÓ븸½ø³ÌÏàͬµÄ´ú ......
1¡¢Ê×ÏÈ´Óhttp://qt.nokia.com/downloads ÏÂÔØ“Qt SDK for Linux”£¬°üÀ¨ÁËQT4.6ºÍQT Creator1.3¡£ Download Qt SDK for Linux/X11 32-bit** (353 MB)
2¡¢ÐÞ¸ÄÎļþqt-sdk-linux-x86-opensource-2009.05.binµÄÊôÐÔ£¬ÈÃÆä¿ÉÖ´ÐУº
chmod u+x qt-sdk-linux-x86-opensource-2009.05.bin
3¡¢Ë«»÷qt-sdk-linux- ......