Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¸ß¼¶Linux³ÌÐòÉè¼ÆµÚÒ»Õ£ºÈëÃÅ

1¡¢ÓÃGCC±àÒë
1.1¡¢´´½¨Ô´Îļþ
(main.c) C Ô´Îļþ - main.c
#include
#include “reciprocal.hpp”
int main (int argc, char **argv)
{
    int i;
    i = atoi (argv[1]);
    printf (“The reciprocal of %d is %g\n”, i, reciprocal (i));
    return 0;
}
(reciprocal.cpp) C++ Ô´Îļþ - reciprocal.cpp
#include
#include “reciprocal.hpp”
double reciprocal (int i) {
    // I should be non-zero.
    assert (i != 0);
    return 1.0/i;
}
(reciprocal.hpp) Í·Îļþ - reciprocal.hpp
#ifdef __cplusplus
    extern “C” {
#endif
    extern double reciprocal (int i);
#ifdef __cplusplus
    }
#endif
1.2¡¢±àÒëÔ´Îļþ
±àÒëmain.c:
% gcc -c main.c
±àÒëreciprocal.cpp:
% g++ -c reciprocal.cpp
²ÎÊý-IÖ¸¶¨ËÑË÷Í·ÎļþµÄλÖá£
ĬÈÏÇé¿öÏ£¬GCCÔÚµ±Ç°Îļþ¼Ð¼°±ê×¼¿âµÄÍ·ÎļþËùÔÚµÄÎļþ¼ÐÀ´ËÑË÷Í·Îļþ¡£
% g++ -c -I ../include reciprocal.cpp
¿ÉÒÔÓòÎÊý-DÔÚÃüÁîÐÐÉ趨ºê(macro)£¬²¢ÇÒ¿ÉÒÔÉ趨ºêµÄÖµ
¶ÔÓÚÈçϳÌÐòdefinemacro.c:
#include "stdio.h"
#include "stdlib.h"
int main(int argc, char** argv){
        int i = 3;
#ifdef CHANGEVALUE
        i = 4;
#endif
        printf("i = %d\n", i);
        printf("PT = %f\n", PI);
}
Èç¹û±àÒëʱÃüÁîÐÐΪgcc definemacro.c£¬»á±¨‘PI’ undeclared´íÎó¡£
Èç¹û±àÒëʱÃüÁîÐÐΪgcc -D PI=3.14 definemacro.c£¬ÔòÊä³öÈçÏ£º
i = 3
PT = 3.140000
Èç¹û±àÒëʱÃüÁîÐÐΪgcc -D PI=3.14 -D CHANGEVALUE definemacro.c£¬ÔòÊä³öÈçÏ£º
i = 4
PT = 3.140000
¿ÉÒÔÓÃGCC±àÒëʱÓÅ»¯´úÂë.
% g++ -c -O2 reciprocal.cpp
1.3¡¢Á´½Ó¶ÔÏóÎļþ
g++¿ÉÒÔ½«.o¶ÔÏóÎļþÁ´½Ó³É³ÌÐò
% g++ -o reciprocal main.o reciprocal.o
Èç¹ûÏëÁ´½ÓÆäËû¿âÎļþ£¬ÔòÓòÎÊý-I
ÀýÈçÓûÁ´½Ó¿âlibpam.a£¬ÔòÓÃÈçÏÂÃüÁîÐУ¬±àÒëÆ÷»á×Ô¶¯¼ÓÉÏǰ׺libºÍºó׺.a
% g++ -o reciprocal mai


Ïà¹ØÎĵµ£º

linux ÐźŴ¦Àí µÄѧϰ

      linuxϵͳÖжÔÐźŵĴ¦ÀíÖ÷ÒªÊÇsignal ºÍsigactionº¯ÊýÀ´Íê³É£¬pauseÓÃÀ´ÏìÓ¦ÈκÎÐźţ¬µ«²»×öÈκδ¦Àí¡£
      1¡£signalº¯Êý
¸Ãº¯ÊýÓÃÀ´ÉèÖýø³ÌÔÚ½Óµ½Ðźŵ͝×÷¡£¿ÉÒÔ man signal²é¿´¾ßÌåÓ÷¨£¬ÏÖÔÚ¶ÔÆäÓ÷¨ÑÝʾ£¬
SIGKILL SIGSTOPÊDz»Äܱ»²¶×½ºÍºöÂÔµÄÐź ......

Linux¼üÅÌÇý¶¯·¶Àý

¼üÅÌÔÚËùÓеÄÇý¶¯Ö®ÖÐ×îΪ¼òµ¥µÄÒ»ÖÖ£¬µ«ËüÈ´°üº¬ÁËÇý¶¯µÄ»ù±¾¿ò¼Ü£¬¶ÔÒÔºó¼ÌÐøÉîÈëѧϰÆäËû¸´ÔÓµÄÇý¶¯´óÓÐñÔÒæ£¬ÒÔϱãΪÄãÖð²½ÆÊÎöÇý¶¯µÄ¿ª·¢¡£²ÉÓõÄÊDzéѯ·½Ê½¡£×ªÔØÇë×¢Ã÷³ö´¦£ºqiangren.blog.edu.cn 
Ò».ÄÚºËÄ£¿éµÄ×¢²áºÍ³·Ïú
ÔÚ¼ÓÔØÄ£¿éµÄʱºò£¬Ê×ÏÈÔËÐеÄÊÇÄÚºËÄ£¿éµÄ×¢²áº¯Êý¡£ËüµÄ¹¦ÄܰüÀ¨ÄÚºË×¢²áÉ豸ÒÔ ......

SynapticsÖúÁ¦Chrome OSºÍLinux¶à點觸Ãþ

4ÔÂ19ÈÕ£¬²Ù×÷½çÃæ½â¾ö·½°¸ÌṩÉÌSynaptics Inc.Ðû²¼ÁËÒ»Ì×ÓÃÓÚLinuxϵ統µÄ Synaptics Gesture Suite¿ª·¢Ì××°£¨SGS-L£©£¬Õâ¿îÈí¼þ½«´ø¸ø¿ªÔ´LinuxϵͳÒÔ¶àµã´¥ÃþµÄÄÜÁ¦¡£
SGS-LÖ§³Ö眾¶àµÄLinux·¢ÐаæÈçFedora, Millos Linpus, Red Flag, SuSE, UbuntuºÍXandros£¬並ÌØ別Ìá¼°¿ÉÍØÕ¹Chrome OSµÄй¦Ä ......

LinuxÄں˴úÂë·ÖÎö slab.c by Áõ¿º


LinuxÄں˴úÂë·ÖÎö slab.c by Áõ¿º liukang@bjut.edu.cn
slab.cÀ´×ÔlinuxÄÚºË2.4.22°æ£¬±¾Îļþ°´ÕÕGNUЭÒé·¢²¼¡£
Ò»¡¢×¼±¸ÖªÊ¶£º
slabµÄ¸ÅÄ
Ìá³öµÄÔ­Òò£ºÓÉÓÚ²Ù×÷ϵͳÔÚÔËÐÐÖл᲻¶Ï²úÉú¡¢Ê¹Óá¢ÊÍ·Å´óÁ¿Öظ´µÄ¶ÔÏó£¬
ËùÒÔ¶ÔÕâÑùµÄÖØ¸´¶ÔÏóµÄÉú³É½øÐиĽø¿ÉÒÔ´ó´óÌá¸ßЧÂÊ
×îÔçÓÉsunµÄ¹¤³ÌʦÌá³ö(1994Äê)²¢Ê×ÏÈÔ ......

Linux ÖÐ RPM ÃüÁî²ÎÊýʹÓÃÏê½â

ÔÚLinux²Ù×÷ϵͳÖУ¬ÓÐÒ»¸öϵͳÈí¼þ°ü£¬ËüµÄ¹¦ÄÜÀàËÆÓÚWindowsÀïÃæµÄ“Ìí¼Ó/ɾ³ý³ÌÐò”£¬µ«Êǹ¦ÄÜÓֱȓÌí¼Ó/ɾ³ý³ÌÐò”Ç¿ºÜ¶à£¬Ëü¾ÍÊÇRed Hat Package Manager(¼ò³ÆRPM)¡£´Ë¹¤¾ß°ü×îÏÈÊÇÓÉRed Hat¹«Ë¾ÍƳöµÄ£¬ºóÀ´±»ÆäËûLinux¿ª·¢ÉÌËù½èÓá£ÓÉÓÚËüΪLinuxʹÓÃÕßʡȥÁ˺ܶàʱ¼ä£¬ËùÒÔ±»¹ã·ºÓ¦ÓÃÓÚÔÚLin ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ