一个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
相关文档:
操作步骤:
1.物理机安装VMWare,在虚拟机中安装Windows XP Professional + SP2
2.VM->Install VMware Tools...
3.在VMware主界面双击Ethernet,并选定Host-only选项
4.在物理机网络连接中,设置VMware Network Adapter VMnet1的IP地址为:130.0.0.50,子网掩码:255.255.0.0,其余为空,作为操作站使用。同时禁用VM ......
使用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 ......
一、开发环境
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.h头文件中声明的各种函数和数据结构的详细使用方法。
关键字:UTC(世界标 ......