Linux GCC makeÎļþµÄд·¨4 ÇåÎú°æ
°üº¬3¸öÎļþ¼Ð£¬ºÍÒ»¸öÎļþMakefile
Ŀ¼×éÖ¯½á¹¹ÈçÏ£º
Makefile
inc/hello.h
main/main.c
src/hello.c
MakefileÎļþÔÚÍâÃæ£¬ÕâÑùÉú³ÉµÄ.oºÍ¿ÉÖ´ÐÐÎļþ¶¼ÔÚÍâÃæ£¬cleanÖ®ºó»áºÜ¸É¾»£¬½á¹¹ÇåÎú
ÎļþÄÚÈÝÈçÏ£º
Makefile(Ö®ËùÒÔÓôóд£¬ÒòΪmake¿ÉÒÔʶ±ðMakefileºÍmakefile£¬Óôóд¿ÉÒÔÏÊÃ÷һЩ)::
# String declaration
objects = main.o hello.o
# Command
app : $(objects)
cc -o app $(objects)
main.o : main/main.c hello.h
cc -c main/main.c
hello.o : src/hello.c stdio.h
cc -c src/hello.c
# Search paths
vpath %.h /usr/include inc
# Clean the intermediate files
.PHONY : clean
clean :
rm app $(objects)
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ÀïËÆºõºÜÑϸñ
hello.c:
#include <stdio.h>
void hello(char name[])
{
printf("Hello %s!\n", name);
}
Ïà¹ØÎĵµ£º
ʲôʱºòÐèÒª´´½¨Ï̳߳ØÄØ£¿¼òµ¥µÄ˵£¬Èç¹ûÒ»¸öÓ¦ÓÃÐèҪƵ·±µÄ´´½¨ºÍÏú»ÙỊ̈߳¬¶øÈÎÎñÖ´ÐеÄʱ¼äÓַdz£¶Ì£¬ÕâÑùÏ̴߳´½¨ºÍÏú»ÙµÄ´øÀ´µÄ¿ªÏú¾Í²»ÈݺöÊÓ£¬ÕâʱҲÊÇÏ̳߳ظóö³¡µÄ»ú»áÁË¡£Èç¹ûÏ̴߳´½¨ºÍÏú»Ùʱ¼äÏà±ÈÈÎÎñÖ´ÐÐʱ¼ä¿ÉÒÔºöÂÔ²»¼Æ£¬ÔòûÓбØÒªÊ¹ÓÃÏ̳߳ØÁË¡£
ÏÂÃæÊÇ ......
ºÍ
WindowsϵͳһÑùLinuxÒ²Óо²Ì¬/¶¯Ì¬Á´½Ó¿â£¬ÏÂÃæ½éÉÜ´´½¨ºÍʹÓ÷½·¨£º
¼ÙÉèÓÐÏÂÃæ¼¸¸öÎļþ£º
Í·ÎļþString.h£¬ÉùÃ÷Ïà¹Øº¯ÊýÔÐΣ¬ÄÚÈÝÈçÏ£º
Strlen.c£º
º¯ÊýStrlenµÄʵÏÖ£¬»ñÈ¡¸ø¶¨×Ö·û´®µÄ³¤¶È£¬ÄÚÈÝÈçÏ£º
Strlnen.c£ºº¯Êý
StrNlenµÄʵÏÖ£¬»ñÈ¡¸ø¶¨×Ö·û´®µÄ³¤¶È£¬Èç¹ûÊäÈë×Ö·û´®µÄ³¤¶È´óÓÚÖ¸¶¨µÄ×î´ó³¤¶È£¬Ô ......
Òý£º
Linux²Ù×÷ϵͳÊÇÓÉLinus TorvaldsÏÈÉúÔÚ1991Äê´´½¨µÄ£¬Ö®ºó²»¶Ï»ñµÃ»¥ÁªÍøÉÏÖÚ¶à³ÌÐòÔ±µÄ×ÔÔ¸Ö§³Ö£¬¾¹ýÊ®¼¸ÄêµÄ·¢Õ¹£¬Èç½ñÒѾ³ÉΪ¼ÌWindowsÖ®ºóµÄµÚ¶þ´óµçÄÔ²Ù×÷ϵͳÈí¼þ¡£
ÄãÊÇ·ñ¶ÔLinuxÓгä·ÖµÄÁ˽âÄØ£¿×÷ΪһÖÖÆ½Ì¨£¬LinuxÊ×ÏÈ»ñµÃÁ˳ÁÄçÓÚijÖÖñ±ºÃ֮ʿºÍºÚ¿ÍÃǵÄ
Çàíù¡£Linux²Ù×÷ϵͳÊÇÓÉLinus
TorvaldsÏÈÉú ......
1¡¢ÔÚlinux϶Á΢Èí±ê×¼µÄchmÎļþʱ£¬ÕÒÁ˺þÃÖÕÓÚÕÒÁËÒ»¿îºÜ²»´íµÄÈí¼þ£££KchmViewer
¿ÉÒÔͨ¹ýÖն˰²×°£º
sudo apt-get install kchmViewer
ʹÓÃubuntuµÄÅóÓÑÒ²¿ÉÒÔÔÚubuntuÈí¼þÖÐÐݲװ¡£
2¡¢LibeFetion·Ç³£ºÃµÄµÚÈý·½Ãâ·Ñ·ÉÐÅÈí¼þ£¬Ò²ÓÐwindows°æ±¾
¹ÙÍøÖ÷Ò³£ºhttp://www.libfetion.org/index.php
ÕæµÄ·Ç³£ºÃÓà ......
ËùÐèÎļþhello.c, main.c, hello.h, Makefile£¬ÔÚͬһ¸öĿ¼ÏÂ
hello.c:
#include <stdio.h>
void hello(char name[])
{
printf("Hello %s!\n", name);
}
main.c:
#include "stdio.h"
#include "hello.h"
// The second
int main()
{
hello("GCC");
printf("Haha Linux Ubuntu!\n");
......