易截截图软件、单文件、免安装、纯绿色、仅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


相关文档:

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链接MYSQL

一、开发环境
1、  windowsXP
 
2、  mysql 5.0.22
3、  Dev-C++ 4.9.9.2
4、  下载(mysqlpp-2.3.2-gcc3.4.2-1due.DevPak) 
5、  MySQL.DevPak 下载地址: http://downloads.sourceforge.net/dev-cpp/MySQL.DevPak
6、   下载以后通过‘工具[T]’ --> 打 ......

(转)C/C++中的日期和时间 time_t与struct tm转换

(转)C/C++中的日期和时间 time_t与struct tm转换
摘要:
本文从介绍基础概念入手,探讨了在C/C++中对日期和时间操作所用到的数据结构和函数,并对计时、时间的获取、时间的计算和显示格式等方面进行了阐述。本文还通过大量的实例向你展示了time.h头文件中声明的各种函数和数据结构的详细使用方法。
关键字:UTC(世界标 ......

C/C++面试题


1.求下面函数的返回值(微软)
int func(x)
{
int countx = 0;
while(x)
{
countx
++;
x = x&(x-1);
}
return countx;
}
假定x = 9999。 答案:8
思路:将x转化为2进制,看含有的1的个数。
2. 什么是“引用”?申明和使用“引用”要注意哪些问题?
答:引用就是某个目标变量的&l ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号