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

Linux GCC makeÎļþµÄд·¨3

 °üº¬3¸öÎļþ¼Ð
Ŀ¼×éÖ¯½á¹¹ÈçÏ£º
inc/hello.h
main/main.c, Makefile
src/hello.c
ÎļþÄÚÈÝÈçÏ£º
hello.h:
void hello(char name[]);
main.c:
#include <stdio.h>
#include "../inc/hello.h"
// The second hello.h should in ""
int main()
{
hello("GCC");
printf("Haha Linux Ubuntu!\n");
return 0;
}
ÆäÖУ¬µÚ¶þ¸ö°üº¬Îļþ£¬hello.h£¬±ØÐëÒªÓÃ""£¬Èç¹ûÓÃ<>ÔògccÖ»»áµ½ÏµÍ³Ä¿Â¼ÏÂÈ¥ËÑË÷£¬²»»áµ½±¾µ±Ç°Ä¿Â¼ÏÂËÑË÷
¾ÍÊÇ""ÔÚÓû§Ä¿Â¼Ï£¬<>ÔÚϵͳĿ¼Ï£¬Õâ¸öÔÚwindowsÉϲ»Ñϸñ£¬ ÔÚlinuxÀïËÆºõºÜÑϸñ
Makefile°æ±¾1:
# String declaration
objects = main.o hello.o
# Command
app : $(objects)
cc -o app $(objects)
main.o : main.c hello.h
cc -c main.c
hello.o : hello.c stdio.h
cc -c ../src/hello.c
# Search paths
vpath %.h /usr/include ../inc
vpath %.c ../src
# Clean the intermediate files
.PHONY : clean
clean :
rm app $(objects)
Ã²ËÆvpathÖ»¶Ô %.o : ºóÃæµÄÓÐÓ°Ï죬ÏÂÃæµÄcc -cûÓÐ×÷ÓÃ
**************************
ȷʵÊÇÕâÑùµÄ£¬
%.o : %.c %.h£¬Õâ¾ä»°ÊÇmakeµÄÓï¾ä£¬¶øÏÂÃæµÄ
cc -c %.c£¬Õâ¾ä»°ÊÇgccµÄÓï¾ä£¬
¶øvpathºÍVPATHÉ趨µÄÊÇmakeµÄËÑË÷·¾¶£¬¶ÔgccµÄËÑË÷·¾¶Ã»ÓÐÓ°Ïì¡£
gccÉèÖÃËÑË÷·¾¶Îª£º
cc -c main.c -Iinclude
**************************
Makefile°æ±¾2£º
# String declaration
objects = main.o hello.o
# Command
app : $(objects)
cc -o app $(objects)
main.o : main.c hello.h
cc -c main.c
hello.o : ../src/hello.c stdio.h
cc -c ../src/hello.c
# Search paths
vpath %.h /usr/include ../inc
#vpath %.c ../src
# Clean the intermediate files
.PHONY : clean
clean :
rm app $(objects)

hello.c:
#include <stdio.h>
void hello(char name[])
{
printf("Hello %s!\n", name);
}


Ïà¹ØÎĵµ£º

Linux¾²Ì¬/¶¯Ì¬Á´½Ó¿âµÄ´´½¨ºÍʹÓÃ


ºÍ
WindowsϵͳһÑùLinuxÒ²Óо²Ì¬/¶¯Ì¬Á´½Ó¿â£¬ÏÂÃæ½éÉÜ´´½¨ºÍʹÓ÷½·¨£º
¼ÙÉèÓÐÏÂÃæ¼¸¸öÎļþ£º
Í·ÎļþString.h£¬ÉùÃ÷Ïà¹Øº¯ÊýÔ­ÐΣ¬ÄÚÈÝÈçÏ£º
Strlen.c£º
º¯ÊýStrlenµÄʵÏÖ£¬»ñÈ¡¸ø¶¨×Ö·û´®µÄ³¤¶È£¬ÄÚÈÝÈçÏ£º
Strlnen.c£ºº¯Êý
StrNlenµÄʵÏÖ£¬»ñÈ¡¸ø¶¨×Ö·û´®µÄ³¤¶È£¬Èç¹ûÊäÈë×Ö·û´®µÄ³¤¶È´óÓÚÖ¸¶¨µÄ×î´ó³¤¶È£¬Ô ......

linux¶¨Ê±Æ÷ÉèÖÃ

10.5.2 ¾«Í¨¶¨Ê±Æ÷ÉèÖÃ
º¯ÊýalarmÉèÖõĶ¨Ê±Æ÷Ö»Äܾ«È·µ½Ã룬¶øÒÔϺ¯ÊýÀíÂÛÉÏ¿ÉÒÔ¾«È·µ½Î¢Ã
#include  <sys/select.h>
#include  <sys/itimer.h>
int getitimer(int which, struct itimerval *value);
int setitimer(int which, const struct itimerval
*value, struct itimerval *ovalue ......

ÔÚlinuxϱȽϺÃÓõÄchmÔĶÁÆ÷ºÍ·ÉÐÅÈí¼þ

1¡¢ÔÚlinux϶Á΢Èí±ê×¼µÄchmÎļþʱ£¬ÕÒÁ˺þÃÖÕÓÚÕÒÁËÒ»¿îºÜ²»´íµÄÈí¼þ£­£­£­KchmViewer
¿ÉÒÔͨ¹ýÖն˰²×°£º
sudo apt-get install kchmViewer
ʹÓÃubuntuµÄÅóÓÑÒ²¿ÉÒÔÔÚubuntuÈí¼þÖÐÐݲװ¡£
2¡¢LibeFetion·Ç³£ºÃµÄµÚÈý·½Ãâ·Ñ·ÉÐÅÈí¼þ£¬Ò²ÓÐwindows°æ±¾
¹ÙÍøÖ÷Ò³£ºhttp://www.libfetion.org/index.php
ÕæµÄ·Ç³£ºÃÓà ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ