编程之路刚刚开始,错误难免,希望大家能够指出。 简单的记录下c文件调用cpp文件,用代码来说明: 命令行:gcc main.c test.cpp 这里其实只需要明白下面这一段就没问题: #ifdef __cplusplus extern "C" { #endif //一段代码 #ifdef __cp ...
分类:
编程语言 时间:
2018-05-08 12:08:01
阅读次数:
236
#ifndef GRAPH_H #define GRAPH_H class Graph { public: Graph(char ch, int n); void draw(); private: char symbol; int size; }; #endif #include "graph...... ...
分类:
其他好文 时间:
2018-04-23 22:41:27
阅读次数:
181
在头文件中添加如下定义:#ifndef _CRT_NO_TIME_Tstruct timespec{ time_t tv_sec; // Seconds - >= 0 long tv_nsec; // Nanoseconds - [0, 999999999]};#endif该代码摘自:time.h文件,不清楚为什么直接包含time.h文件仍然找不到定义
分类:
其他好文 时间:
2018-04-16 12:11:44
阅读次数:
268
第九章 内存模型和名称空间 1、不要将函数定义或者变量声明放到头文件中。 2、头文件常包含的内容:函数原型、使用#define或者const定义的常量、结构声明、类声明、模板声明、内联函数。 3、避免多次包含同一个头文件的技术:#ifndef/#endif。仅当以前没有使用预处理器编译指令#defi ...
分类:
编程语言 时间:
2018-04-13 16:19:48
阅读次数:
175
行注释:// 从//开始的一行为注释内容 块注释:/*...*/ 从/* 开始到 */结束为注释内容 代码注释: #if 0 代码区 #endif 代码区为注释内容 当然这个方式也可以灵活用来测试某段代码! ...
分类:
编程语言 时间:
2018-04-11 23:11:16
阅读次数:
309
#include #include #include #include #ifnndef WIN32 #include #include #endif #define DEFAULT_DISK_PATH "/work" typedef struct statfs DISK,*pDISK; //获取包... ...
分类:
系统相关 时间:
2018-04-07 13:59:52
阅读次数:
258
功能模块名称 审查人 陈大千 审查日期 2018.4.5 代码名称 代码作者 李子涵 文件结构 重要性 审查项 结论 头文件和定义文件的名称是否合理? 头文件和定义文件的目录结构是否合理? 版权和版本声明是否完整? 重要 头文件是否使用了 ifndef/define/endif 预处理块? 头文件中 ...
分类:
其他好文 时间:
2018-04-05 11:34:16
阅读次数:
137
注: N : 代表某个版本<!--[if !IE]><!--> 除IE外都可识别 <!--<![endif]--><!--[if IE]> 所有的IE可识别 <![endif]--><!--[if IE N]> 仅IE[N]可识别 <![endif]--><!--[if lt IE N]> IE[N ...
分类:
Web程序 时间:
2018-04-03 18:13:33
阅读次数:
253
1 #ifdef _WIN32 2 #define __USE_MINGW_ANSI_STDIO 1 3 #endif 4 5 #include 6 #include 7 #include 8 #include 9 #include 10 #ifdef HAS_STDINT_H 11 #includ... ...
分类:
移动开发 时间:
2018-03-16 22:42:11
阅读次数:
1369
1,防止一个头文件被重复包含 #ifndef COMDEF_H #define COMDEF_H //头文件内容 #endif 2,重新定义一些类型,防止由于各种平台和编译器的不同,而产生的类型字节数 差异,方便移植。 typedef unsigned char boolean; /* Boolea ...
分类:
编程语言 时间:
2018-03-16 17:24:39
阅读次数:
197