易截截图软件、单文件、免安装、纯绿色、仅160KB

一个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
---------------------------------
//cExample.c
#include"cExample.h"
int add(int x, int y)
{
 return x + y;
}
---------------------------------
//cppFile.cpp
#include <iostream>
#include"cExample.h"
using namespace std;
main()
{
    cout<<add(2,3)<<endl;
    return 0;
}
--------------------------------
//makefile
cppFile: cppFile.o cExample.o
    g++ -g -o cppFile cppFile.o cExample.o
cppFile.o: cppFile.cpp
    g++ -g -c cppFile.cpp
cExample.o: cExample.c cExample.h
    gcc -g -c cExample.c
clean:
    rm -f *.o cppFile


相关文档:

linux环境编译c++动态库以及调用方式

上一次用linux是2002年用kdevelop及qt库开发多媒体软件。
时隔8年再一次在linux下搞开发,依然菜鸟,还是生疏。
感觉自己的大脑的存储空间,随着年龄的增加在变小,很多弄过的,又只能从头学起。
不过有句话“活到老,学到老”哈!
惭愧,惭愧。
1、编写动态库的c++文件
    cvpnlib.cpp cv ......

c++ mysql

/*
 * test.cpp
 *
 *  Created on: 2010-5-13
 *      Author: Sarah
 */
  #include   "/usr/include/mysql/mysql.h"   /*为绝对路径*/
  #include   <stdio.h>
#include <stdlib.h>
#i ......

使用NDK开发C/C++项目规则(ZT)

使用NDK开发C/C++项目规则
<!-- /* Font Definitions */ @font-face {font-family:宋体; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;}@font-face {font-family:"\@宋体&qu ......

C/C++/VC MFC char & int study

测试代码一(VC6.0、C-code):
#include <stdio.h>
void main()
{
 int aa;
 unsigned char j1,j2;
 aa=j1=j2=0;
 aa=49;
 j1=aa;
 printf("j1=%d \n",j1);
 j2=aa;
 printf("j2=%c \n",j2);
}
【分析】:
[1]正如所想象的输出结果:
    j1 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号