Linux下C和C++开发基础
Linux下C和C++开发基础
基本编程概念
n 编程语言:C 、C++
n 编译(compile):源文件(.c)->目标文件(.o)
n 连接(link):目标文件(.o)->可执行文件
n 库(library):静态连接库(.a)、动态连接库(.so)
Linux下开发工具
n编辑器:vi、emacs、窗口编辑器
n编译器:GCC
n调试器:GDB
n可执行文件工具:Binutils
n连接器:ld
n汇编程序:as
n库管理工具:ar
n可执行文件符号管理:nm
n显示可执行文件信息:objdump
简单程序示例(C语言):
n hello.c
/***************************
C代码
#i nclude <stdio.h>
int main(int argc,char **argv)
{
printf("HelloWorld!\n");
return 0;
}
/***************************
n编译方法:gcc –o hello hello.c
n运行方法:./hello
简单程序示例(C++语言):
#i nclude <stdio.h>
int main(int argc,char **argv)
{
printf("HelloWorld!\n");
return 0;
}
/***************************
n编译方法:gcc –o hello hello.c
n运行方法:./hello
简单程序示例(C++语言):
n hello.cpp
/*******************************
C代码
#i nclude <iostream>
using namespace std;
int main(int argc,char **argv)
{
cout << "Hello World!“ << endl;
return 0;
}
#i nclude <iostream>
using namespace std;
int main(int argc,char **argv)
{
cout << "Hello World!“ << endl;
return 0;
}
/*******************************
n 编译方法:g++ –o hello hello.cpp
n 运行方法:./hello
GCC编译器
n GNU平台下主流编译器
n目前最新稳定版4.0
n官方网站:http://gcc.gnu.org
n支持编译语言:C、C++、Objective-C、
Objective-C++、Java、Fortran、Ada
n跨平台支持:支持几乎所有主流操作系统,如
Linux、UNIX、Windows等。支持多种硬件平
台,如X86、ARM、PPC、MIPS等
n交叉编译
相关文档:
一:前言
最近在研究android的sensor driver,主要是E-compass,其中用到了Linux input子系统.在网上也看了很多这方面的资料,感觉还是这篇分析的比较细致透彻,因此转载一下以便自己学习,同时和大家分享!
(这篇博客主要是以键盘驱动为例的,不过讲解的是Linux Input Subsystem,可以仔细的研究一下!)
键盘驱动将检 ......
Boss说,要看OpenGL,看了快一个月,总算出了个像样的东西,用C写了个3D迷宫,
虽然只有350行
代码,不过边学边写,足足写了一周时间,还是小有成就感的,活活活!
&n ......
/*
* 2010-1-21
* 该文件时内核中有关任务调度的函数程序,其中包含基本函数sleep_on,
* wakeup,schedule等,以及一些简单的系统调用。同时将软盘的几个操作
* 函数也放置在这里。
*
* schedule函数首先对所有的任务检查,唤醒任何一个已经得到信号的任务,
* ......
linux spi驱动
内核版本:linux-2.6.29
主要的几个结构
platform_device platform_driver s3c24xx_spi spi_master spi_bitbang spi_device spi_driver spidev_data s3c_spi_info
第一步:注册platform_device
在arch/arm/mach-s3c2410/mach-qt2410.c 中注册platform_device ,其中s3c2410_spi_info 作为plat ......