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

android ±àÒëNative CµÄhello,worldÄ£¿é

±àÒëNative CµÄhello,worldÄ£¿é
    Android ±àÒë»·¾³±¾Éí±È½Ï¸´ÔÓ£¬ÇÒ²»ÏñÆÕͨµÄ±àÒë»·¾³£ºÖ»Óж¥²ãĿ¼Ï²ÅÓÐMakefileÎļþ£¬¶øÆäËûµÄÿ¸öcomponent¶¼Ê¹ÓÃͳһ±ê×¼µÄ Android.mk. Android.mkÎļþ±¾ÉíÊDZȽϼòµ¥µÄ£¬²»¹ýËü²¢²»ÊÇÎÒÃÇÊìϤµÄMakefile£¬¶øÊǾ­¹ýÁËAndroid×ÔÉí±àÒëϵͳµÄºÜ¶à´¦Àí£¬Òò´ËÒªÕæÕýÀíÇå³þÆäÖеÄÁªÏµ»¹±È½Ï¸´ÔÓ£¬²»¹ýÕâÖÖ·½Ê½µÄºÃ´¦ÔÚÓÚ£¬±àдһ¸öеÄAndroid.mkÀ´¸øAndroidÔö¼ÓÒ»¸öеÄComponent»á±È½Ï¼òµ¥¡£±àÒëJava³ÌÐò¿ÉÒÔÖ±½Ó²ÉÓÃEclipseµÄ¼¯³É»·¾³À´Íê³É£¬ÕâÀï¾Í²»Öظ´ÁË¡£ÎÒÃÇÖ÷ÒªÕë¶ÔC/C++À´ËµÃ÷£¬ÏÂÃæͨ¹ýÒ»¸öСÀý×ÓÀ´ËµÃ÷£¬ÈçºÎÔÚAndroid ÖÐÔö¼ÓÒ»¸öC³ÌÐòµÄHello World£º
1. ÔÚ$(YOUR_ANDROID)/developmentĿ¼Ï´´½¨helloĿ¼£¬ÆäÖÐ$(YOUR_ANDROID)Ö¸AndroidÔ´´úÂëËùÔÚµÄĿ¼¡£
$ mkdir $(YOUR_ANDROID)/development/hello
2. ÔÚ$(YOUR_ANDROID)/development/hello/Ŀ¼±àдhello.cÎļþ£¬hello.cµÄÄÚÈݵ±È»¾ÍÊǾ­µäµÄHelloWorld³ÌÐò£º
#include <stdio.h>
int main()
{
    printf("Hello World!\n");
    return 0;
}
3.ÔÚ$(YOUR_ANDROID)/development/hello/Ŀ¼±àдAndroid.mkÎļþ¡£ÕâÊÇAndroid MakefileµÄ±ê×¼ÃüÃû£¬²»Òª¸ü¸Ä¡£Android.mkÎļþµÄ¸ñʽºÍÄÚÈÝ¿ÉÒԲο¼ÆäËûÒÑÓеÄAndroid.mkÎļþµÄд·¨£¬Õë¶Ôhelloworld³ÌÐòµÄAndroid.mkÎļþÄÚÈÝÈçÏ£º
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
 
LOCAL_SRC_FILES:= \
    hello.c
 
LOCAL_MODULE := helloworld
include $(BUILD_EXECUTABLE)
×¢ÒâÉÏÃæLOCAL_SRC_FILESÓÃÀ´Ö¸¶¨Ô´Îļþ£¬LOCAL_MODULEÖ¸¶¨Òª±àÒëµÄÄ£¿éµÄÃû×Ö£¬ÏÂÒ»²½Öè±àÒëʱ¾ÍÒªÓõ½¡£include $(BUILD_EXECUTABLE)±íʾҪ±àÒë³ÉÒ»¸ö¿ÉÖ´ÐÐÎļþ£¬Èç¹ûÏë±àÒë³É¶¯Ì¬¿âÔò¿ÉÓÃBUILD_SHARED_LIBRARY£¬ÕâЩ¿ÉÒÔÔÚ$(YOUR_ANDROID)/build/core/config.mk²éµ½¡£
4. »Øµ½AndroidÔ´´úÂ붥²ãĿ¼½øÐбàÒ룺
# cd $(YOUR_ANDROID) && make helloworld
×¢Òâmake helloworldÖеÄÄ¿±êÃûhelloworld¾ÍÊÇÉÏÃæAndroid.mkÎļþÖÐÓÉLOCAL_MODULEÖ¸¶¨µÄÄ£¿éÃû¡£
±àÒë½á¹ûÈçÏ£º
target thumb C: helloworld <= development/hello/hello.c
target Executable: helloworld (out/target/product/generic/obj/EXECUTABLES/helloworld_intermediates/LINKED/helloworld)
target Non-preli


Ïà¹ØÎĵµ£º

LINUX C ¶¨Ê±Æ÷

¡¾ÊµÏÖ¹¦ÄÜ¡¿£ºLinuxϵÄC±à³Ì£º±àдһ¸ö³ÌÐò£¨¿â£©£¬ÊµÏÖ¶¨Ê±Æ÷£¨¼ÆʱÆ÷£©µÄ¹¦ÄÜ£¬ËüÄÜΪÓû§ÌṩÔÚͬһ½ø³ÌÖжà´ÎʹÓõĶ¨Ê±Æ÷¡£ÕâÀïÒªÇóÓÃÐźÅÀ´ÊµÏÖ¡£
¡¾½âÌâ˼·¡¿£º±àдһ¸ö½á¹¹ÌåTimer´ú±íÒ»¸ö¼ÆʱÆ÷£¬È»ºóÔÙ¶¨ÒåTimerÀàÐ͵ÄÊý×émyTimer[N]£¬ÓÃÀ´±£´æÎÒÃÇÉèÖõĶ¨Ê±Æ÷£»ÔÙ¶¨Ò庯ÊýsetTimer£¨£©Éú³É¼ÆʱÆ÷£¬²¢½«Éú³É ......

51µ¥Æ¬»ú Keil C ÑÓʱ³ÌÐòµÄ¼òµ¥Ñо¿

51µ¥Æ¬»ú   Keil   C   ÑÓʱ³ÌÐòµÄ¼òµ¥Ñо¿  
   
  by:   InfiniteSpace   Studio/isjfk,   1.21.2004  
   
  ÈκÎÈ˶¼¿ÉÒÔÔÚ×¢Ã÷Ô­×÷Õߺͳö´¦µÄÇ°ÌáÏÂËæÒâתÔØÕâƪÎÄÕ£¬µ«²»µÃÓÃÓÚÉÌҵĿµÄ¡£  
   
    ......

C/C++µ¥Ôª²âÊÔÀíÂÛ¾«Òª£¨Ê®¶þ£¬Í꣩

4.2 ¶à½Ç¶È±£Ö¤²âÊÔЧ¹û
    ¶ÔÓÚ´úÂëÖÊÁ¿ÒªÇóºÜ¸ßµÄÏîÄ¿À´Ëµ£¬½öÓа׺и²¸ÇÊÇÔ¶Ô¶²»¹»µÄ¡£°×ºÐ¸²¸Ç²»ÄÜ·¢ÏÖ´úÂëȱʧ£¬°×ºÐ¸²¸Ç»ùÓÚÏÖÓдúÂ룬Èç¹û´úÂë²»´æÔÚ£¬µ±È»²»ÄÜ·¢ÏÖ¡£ÎªÁ˼ì²â´úÂëȱʧ£¬ÐèÒªÈ˹¤¶Ô²âÊÔÊý¾Ý½øÐмì²é¡£°×ºÐ¸²¸ÇÒ²²»ÄÜ·¢ÏÖÓÃÀýδ·´Ó³¹¦ÄÜ¡£Èç¹ûÉè¼ÆÓÃÀýʱ£¬²âÊÔÔ±²»Á˽â´úÂëµÄ¹¦ÄÜ£¬Í ......

ÓÅ»¯C´úÂë³£Óõļ¸ÕÐ

ÓÅ»¯C´úÂë³£Óõļ¸ÕÐ
ÔÚÐÔÄÜÓÅ»¯·½ÃæÓÀԶעÒâ80-20Ô­Ôò£¬¼´20%µÄ³ÌÐòÏûºÄÁË80%µÄÔËÐÐʱ¼ä£¬Òò¶øÎÒÃÇÒª¸Ä½øЧÂÊ£¬×îÖ÷ÒªÊÇ¿¼ÂǸĽøÄÇ20%µÄ´úÂë¡£²»ÒªÓÅ»¯³ÌÐòÖпªÏú²»´óµÄÄÇ80%£¬ÕâÊÇÀͶøÎÞ¹¦µÄ¡£
µÚÒ»ÕУºÒԿռ任ʱ¼ä
¼ÆËã»ú³ÌÐòÖÐ×î´óµÄì¶ÜÊÇ¿Õ¼äºÍʱ¼äµÄì¶Ü£¬ÄÇô£¬´ÓÕâ¸ö½Ç¶È³ö·¢ÄæÏò˼άÀ´¿¼ÂdzÌÐòµÄЧÂÊÎÊÌ⣬ÎÒ ......

cÎļþ²Ù×÷: (1)ÎļþµÄ»ù±¾¸ÅÄî

¡¡¡¡Ëùν“Îļþ”ÊÇÖ¸Ò»×éÏà¹ØÊý¾ÝµÄÓÐÐò¼¯ºÏ¡£ Õâ¸öÊý¾Ý¼¯ÓÐÒ»¸öÃû³Æ£¬½Ð×öÎļþÃû¡£ ʵ¼ÊÉÏÔÚÇ°ÃæµÄ¸÷ÕÂÖÐÎÒÃÇÒѾ­¶à´ÎʹÓÃÁËÎļþ£¬ÀýÈçÔ´³ÌÐòÎļþ¡¢Ä¿±êÎļþ¡¢¿ÉÖ´ÐÐÎļþ¡¢¿âÎļþ (Í·Îļþ)µÈ¡£Îļþͨ³£ÊÇפÁôÔÚÍⲿ½éÖÊ(Èç´ÅÅ̵È)Éϵģ¬ ÔÚʹÓÃʱ²Åµ÷ÈëÄÚ´æÖÐÀ´¡£´Ó²»Í¬µÄ½Ç¶È¿É¶ÔÎļþ×÷²»Í¬µÄ·ÖÀà¡£´ÓÓû ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ