C语言条件编译
C语言 编译 条件
2023-09-14 09:07:07 时间
一,条件编译的命令包括
1, #ifdef - #endif
2, #ifndef - #define - #endif 以及 #ifdef - #else - #endif
3, #if - #endif 以及 #if – #elif – #endif
4, #ifdef - #else - #endif
二条件编译命令举例
1,#ifdef-#endif
#ifdef FLASH_TEST
code
#endif
2,#ifndef - #define - #endif 以及 #ifdef - #else - #endif
#ifndef - #define - #endif 通常用于定义头文件。
#ifndef __AAAA_H__
#define __AAAA_H__
code
#endif
#ifdef - #else - #endif
#ifdef __cplusplus
extern "C"
{
#else
code
#endif
#ifdef - #endif
#ifdef __cplusplus
extern "C"
{
#endif
3, #if - #endif 以及 #if – #elif – #endif
#if KERNAL_VERSION=2.6.32
code
#endif
#if KERNAL_VERSION=2.6.32
code
#elif KERNEL_VERSION= 4.19
code
#endif
OR
#if defined(KERNAL_DEBUG)
code
#endif
#if defined(AAA_8)
code
#elif defined(AAA_16)
code
#elif defined(AAA_32)
code
#endif
4, #ifdef - #else - #endif
#ifdef KERNAL_DEBUG
code
#else
code
#endif
其中#if defined的用法和#ifdef的用法是一样的。
相关文章
- 浙大版《C语言程序设计(第3版)》题目集 1~10
- 实型变量_C语言实型常数的合法形式
- 初识C语言(上):基本了解C语言的基础知识,对C语言有一个大概的认识。
- 【C语言】程序环境和预编译
- Linux下编译C语言实现自动化(linux编译c代码)
- 语言Linux下编译C语言指南(linux下怎么编译c)
- C语言跳转语句(break语句,continue语句,goto语句,return语句)
- GCC编译C语言程序完整演示
- Linux下C语言程序的编译与执行(linuxc编译执行)
- Linux下使用C语言编写库函数(linuxc语言库)
- 程序开发Linux下C语言程序开发:实现一键脚本编译(linux下c语言)
- 程序Linux下编译C语言程序:实现新功能(linux下编译c)
- 编译在Linux系统中编译C语言源代码(linux下c源代码)
- MySQL编译:数据库C语言支持的完美解决方案(cmysql编译)
- Linux C编程参考指南完整版:超全面的C语言开发必备工具书(linuxc参考)
- 快速搞定文件传输:Linux下C语言技巧(linuxc文件传输)
- 结合的优势C语言与Linux结合,创造无穷优势(c语言与linux系统)
- C语言编写MySQL连接代码实现数据库交互(c 与mysql连接代码)
- 编译解锁MySQL性能C语言源码编译实战(c mysql 源码)
- C语言和MySQL结合从入门到精通(c mysql使用教程)
- Oracle数据库应用C语言调用Oracle包(c 调用oracle的包)
- C语言访问Oracle视图一种实现方案(c 访问oracle视图)
- 如何将C语言代码转换为应用程序(也就是编译)
- 16种C语言编译警告(Warning)类型的解决方法
- C语言实现输入一颗二元查找树并将该树转换为它的镜像