现在的位置: 首页 > 综合 > 正文

hello world!应用程序

2018年02月01日 ⁄ 综合 ⁄ 共 527字 ⁄ 字号 评论关闭

1、准备测试源代码和Makefile

helloworld.c
#include <stdio.h>
int main(void)
{
 printf("hello world!/n");
 return 0;

}
 

Makefile

CFLAGS    = -Wall -O2

CC     = arm-linux-gcc
INSTALL    = install

TARGET    = HelloWorld

all: $(TARGET)

HelloWorld: helloworld.c
 $(CC) $(CFLAGS) $< -o $@

install: $(TARGET)
 $(INSTALL) $^ $(DESTDIR)/usr/bin

clean distclean:
 rm -rf *.o $(TARGET)

# ----------------------------------------------------------------------------

.PHONY: $(PHONY) install clean distclean

2、编译运行

执行make命令,生成hello.o。在开发板通过nfs协议mount命令挂载主机共享目录,进入目录执行./hello,结果显示“hello world!”,应用程序测试结束。

 

 

抱歉!评论已关闭.