C++ µ÷C Cµ÷c++
Ò»¡¢c++ µ÷C:
/* cÓïÑÔÍ·Îļþ£ºcExample.h */
#ifndef C_EXAMPLE_H
#define C_EXAMPLE_H
#ifdef __cplusplus
extern "C"
{
#endif
int add(int x,int y);
#ifdef __cplusplus
}
#endif
#endif
/* cÓïÑÔʵÏÖÎļþ£ºcExample.c */
#include "cExample.h"
int add( int x, int y )
{
return x + y;
}
// main.cpp
#include <iostream>
using namespace std;
// c++ʵÏÖÎļþ£¬µ÷ÓÃadd()
#include "cExample.h"
int main(int argc, char* argv[])
{
cout << add(2,3) << endl;
return 0;
}
¶þ¡¢Cµ÷C++
//C++Í·Îļþ cppExample.h
#ifndef CPP_EXAMPLE_H
#define CPP_EXAMPLE_H
#ifdef __cplusplus
extern "C"
{
#endif
int add(int x,int y);
#ifdef __cplusplus
}
#endif
#endif
//C++ʵÏÖÎļþ cppExample.cpp
#include "cppExample.h"
int add( int x, int y )
{
return x + y;
}
/* CʵÏÖÎļþ */
#include <stdio.h>
#include "cppExample.h"
int main( int argc, char* argv[] )
{
printf ("%d\n", add( 2, 3 ));
return 0;
}
Ïà¹ØÎĵµ£º
(Ò»)дһ¸ö¼òµ¥µÄ¿É±ä²ÎÊýµÄCº¯Êý
ÏÂÃæÎÒÃÇÀ´Ì½ÌÖÈçºÎдһ¸ö¼òµ¥µÄ¿É±ä²ÎÊýµÄCº¯Êý.д¿É±ä²ÎÊýµÄ
Cº¯ÊýÒªÔÚ³ÌÐòÖÐÓõ½ÒÔÏÂÕâЩºê:
void va_start( va_list arg_ptr, prev_param );
type va_arg( va_list arg_ptr, type );
void va_end( va_list arg_ptr );
vaÔÚÕâÀïÊÇvariable-argument(¿É±ä²ÎÊý)µÄÒâ˼.
ÕâÐ ......
±¾ÎĽéÉÜÔÚGNU/Linux»·¾³ÏÂÒ»¸öC³ÌÐòÓÉÔ´´úÂëµ½³ÌÐò£¬µ½¼ÓÔØÔËÐУ¬×îºóÖÕÖ¹µÄ¹ý³Ì¡£Í¬Ê±ÒԴ˹ý³ÌÎªÔØÌ壬½éÉÜGNU/Linuxƽ̨ÏÂÈí¼þ¿ª·¢¹¤¾ßµÄʹÓá£
±¾ÎÄÒÔÎÒÃÇ×î³£¼ûµÄhello, world!ΪÀý£º
#include <stdio.h>
main ()
{
printf(“hello, world!\n” ......
×î½üÔÚ×öÒ»¸öI2C¼üÅ̵ÄLinuxÇý¶¯£¬²Î¿¼ÁËÆäËûоƬµÄһЩ´úÂ룬ÆäÖÐÂ½Ðø·¢ÏÖÓÐЩÈÃÈËÃÔ»óµÄ¶«Î÷£¬°ÑÎÒµÄÃÔ»ó¼°Àí½âÔÚÕâÀï¼ÓÒԼǼ£º
1. i2c_driver½á¹¹ÌåµÄprobe³ÉÔ±µÄÔÐÍ£º
int (*probe)(struct i2c_client *, const struct i2c_device_id *);
¼´£ºprobeº¯Êý±»µ÷ÓÃʱ»á´ÓÉϱߴ«Á½¸ö¸ö²Î ......
C¿âº¯Êý
×Ö·û´®º¯Êý
º¯ÊýÃû
º¯ÊýÔÐÍ
¹¦ÄÜ
·µ»ØÖµ
°üº¬Í·Îļþ
strcat
char *strcat(char *st1, char *str2)
°Ñstr2Á¬½Óµ½str1ºóÃæ
str1
string.h
strchr
char *strchr(char *str, int ch)
ÕÒ³östrÖ¸ÏòµÄ×Ö·û´®ÖеÚÒ»´Î³öÏÖ×Ö·û´®chµÄλÖÃ
Ö¸Ïò¸ÃλÖõÄÖ¸Õ룬δÕÒµ½Ôò·µ»Ø¿ÕÖ¸Õë
......
C/C++ development with the Eclipse Platform
Pawel Leszek
ÕªÒª:ͨ¹ý±¾ÎÄÄ㽫»ñµÃÈçºÎÔÚEclipseƽ̨ÉÏ¿ª·¢C/C++ÏîÄ¿µÄ×ÜÌåÈÏʶ¡£ËäÈ»EclipseÖ÷Òª±»ÓÃÀ´¿ª·¢JavaÏîÄ¿£¬µ«ËüµÄ¿ò¼ÜʹµÃËüºÜÈÝÒ×ʵÏÖ¶ÔÆäËû¿ª·¢ÓïÑÔµÄÖ§³Ö¡£ÔÚÕâÆªÎÄÕÂÀÄ㽫ѧ»áÈçºÎʹÓÃCDT(C/C++ Development Toolkit)£¬Ò»¸öÔÚEclipseƽ̨ÉÏ×î ......