社区
C++ Builder
帖子详情
1.有关#define与#ifdef的问题
whitetiger8
2002-04-21 06:46:12
大家看代码:
#ifndef dllmainh
#define dllmainh
....
#endif
....
请问第一句与第二句的意思是什么呢?主要是第二句,它定义的是谁啊?虽然它目的是声明一个特定的字符串,可是它代表谁呢?怎么看?
...全文
46
4
打赏
收藏
1.有关#define与#ifdef的问题
大家看代码: #ifndef dllmainh #define dllmainh .... #endif .... 请问第一句与第二句的意思是什么呢?主要是第二句,它定义的是谁啊?虽然它目的是声明一个特定的字符串,可是它代表谁呢?怎么看?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
jerrymousenet2
2002-04-21
打赏
举报
回复
老兄多看看帮助吧!
jerrymousenet2
2002-04-21
打赏
举报
回复
又是你。
whitetiger8
2002-04-21
打赏
举报
回复
谢谢!
jishiping
2002-04-21
打赏
举报
回复
这样做的目的是不让头文件重复定义。这儿的名字并不一定非要是dllmainh,
只要在你的程序中不要重复定义就可以了。一般来说,名字取为头文件的文件
名,将文件名的.去掉,这样就肯定不会重复了。
AVR示波器工程制作
/********************************************************************** 头文件功能说明:AVR单片机 引脚 位操作 最后修改: SSTA_XJL 时间: 2009.3.28 **********************************************************************/ #ifn
def
_BIT_H_ #
def
ine
_BIT_H_ /******************************位段定义*****************************************/ type
def
struct{ unsigned BIT0 : 1 ; unsigned BIT1 : 1 ; unsigned BIT2 : 1 ; unsigned BIT3 : 1 ; unsigned BIT4 : 1 ; unsigned BIT5 : 1 ; unsigned BIT6 : 1 ; unsigned BIT7 : 1 ; }PBIT; /*******************************数据类型申明***************************************/ #ifn
def
uint #
def
ine
uint unsigned int #endif #ifn
def
uchar #
def
ine
uchar unsigned char #endif #ifn
def
ulong #
def
ine
ulong unsigned long #endif /**********************************************************************************/ /***********************************************************************/ #
def
ine
SET_ADDRESS(Var) (*((volatile PBIT *)&(Var))) /**************************************************************************/ #if
def
PORTA #
def
ine
PORTA_BIT SET_ADDRESS(PORTA) #endif #if
def
PORTB #
def
ine
PORTB_BIT SET_ADDRESS(PORTB) #endif #if
def
PORTC #
def
ine
PORTC_BIT SET_ADDRESS(PORTC) #endif #if
def
PORTD #
def
ine
PORTD_BIT SET_ADDRESS(PORTD) #endif #if
def
PORTE #
def
ine
PORTE_BIT SET_ADDRESS(PORTE) #endif #if
def
PORTF #
def
ine
PORTF_BIT SET_ADDRESS(PORTF) #endif #if
def
PORTG #
def
ine
PORTG_BIT SET_ADDRESS(PORTG) #endif /*******************************************************************************/ #if
def
DDRA #
def
ine
DDRA_BIT SET_ADDRESS(DDRA) #endif #if
def
DDRB #
def
ine
DDRB_BIT SET_ADDRESS(DDRB) #endif #if
def
DDRC #
def
ine
DDRC_BIT SET_ADDRESS(DDRC) #endif #if
def
DDRD #
def
ine
DDRD_BIT SET_ADDRESS(DDRD) #endif #if
def
DDRE #
def
ine
DDRE_BIT SET_ADDRESS(DDRE) #endif #if
def
DDRF #
def
ine
DDRF_BIT SET_ADDRESS(DDRF) #endif #if
def
DDRG #
def
ine
DDRG_BIT SET_ADDRESS(DDRG) #endif /**********************************************************/ #if
def
PINA #
def
ine
PINA_BIT SET_ADDRESS(PINA) #endif #if
def
PINB #
def
ine
PINB_BIT SET_ADDRESS(PINB) #endif #if
def
PINC #
def
ine
PINC_BIT SET_ADDRESS(PINC) #endif #if
def
PIND #
def
ine
PIND_BIT SET_ADDRESS(PIND) #endif #if
def
PINE #
def
ine
PINE_BIT SET_ADDRESS(PINE) #endif #if
def
PINF #
def
ine
PINF_BIT SET_ADDRESS(PINF) #endif #if
def
PING #
def
ine
PING_BIT SET_ADDRESS(PING) #endif /******************************************************************************/ #if
def
PORTA #
def
ine
PA_0 PORTA_BIT.BIT0 #
def
ine
PA_1 PORTA_BIT.BIT1 #
def
ine
PA_2 PORTA_BIT.BIT2 #
def
ine
PA_3 PORTA_BIT.BIT3 #
def
ine
PA_4 PORTA_BIT.BIT4 #
def
ine
PA_5 PORTA_BIT.BIT5 #
def
ine
PA_6 PORTA_BIT.BIT6 #
def
ine
PA_7 PORTA_BIT.BIT7 #endif #if
def
PORTB #
def
ine
PB_0 PORTB_BIT.BIT0 #
def
ine
PB_1 PORTB_BIT.BIT1 #
def
ine
PB_2 PORTB_BIT.BIT2 #
def
ine
PB_3 PORTB_BIT.BIT3 #
def
ine
PB_4 PORTB_BIT.BIT4 #
def
ine
PB_5 PORTB_BIT.BIT5 #
def
ine
PB_6 PORTB_BIT.BIT6 #
def
ine
PB_7 PORTB_BIT.BIT7 #endif #if
def
PORTC #
def
ine
PC_0 PORTC_BIT.BIT0 #
def
ine
PC_1 PORTC_BIT.BIT1 #
def
ine
PC_2 PORTC_BIT.BIT2 #
def
ine
PC_3 PORTC_BIT.BIT3 #
def
ine
PC_4 PORTC_BIT.BIT4 #
def
ine
PC_5 PORTC_BIT.BIT5 #
def
ine
PC_6 PORTC_BIT.BIT6 #
def
ine
PC_7 PORTC_BIT.BIT7 #endif #if
def
PORTD #
def
ine
PD_0 PORTD_BIT.BIT0 #
def
ine
PD_1 PORTD_BIT.BIT1 #
def
ine
PD_2 PORTD_BIT.BIT2 #
def
ine
PD_3 PORTD_BIT.BIT3 #
def
ine
PD_4 PORTD_BIT.BIT4 #
def
ine
PD_5 PORTD_BIT.BIT5 #
def
ine
PD_6 PORTD_BIT.BIT6 #
def
ine
PD_7 PORTD_BIT.BIT7 #endif #if
def
PORTE #
def
ine
PE_0 PORTE_BIT.BIT0 #
def
ine
PE_1 PORTE_BIT.BIT1 #
def
ine
PE_2 PORTE_BIT.BIT2 #
def
ine
PE_3 PORTE_BIT.BIT3 #
def
ine
PE_4 PORTE_BIT.BIT4 #
def
ine
PE_5 PORTE_BIT.BIT5 #
def
ine
PE_6 PORTE_BIT.BIT6 #
def
ine
PE_7 PORTE_BIT.BIT7 #endif #if
def
PORTF #
def
ine
PF_0 PORTF_BIT.BIT0 #
def
ine
PF_1 PORTF_BIT.BIT1 #
def
ine
PF_2 PORTF_BIT.BIT2 #
def
ine
PF_3 PORTF_BIT.BIT3 #
def
ine
PF_4 PORTF_BIT.BIT4 #
def
ine
PF_5 PORTF_BIT.BIT5 #
def
ine
PF_6 PORTF_BIT.BIT6 #
def
ine
PF_7 PORTF_BIT.BIT7 #endif #if
def
PORTG #
def
ine
PG_0 PORTG_BIT.BIT0 #
def
ine
PG_1 PORTG_BIT.BIT1 #
def
ine
PG_2 PORTG_BIT.BIT2 #
def
ine
PG_3 PORTG_BIT.BIT3 #
def
ine
PG_4 PORTG_BIT.BIT4 #
def
ine
PG_5 PORTG_BIT.BIT5 #
def
ine
PG_6 PORTG_BIT.BIT6 #
def
ine
PG_7 PORTG_BIT.BIT7 #endif /**********************************************************************/ #if
def
DDRA #
def
ine
DDRA_0 DDRA_BIT.BIT0 #
def
ine
DDRA_1 DDRA_BIT.BIT1 #
def
ine
DDRA_2 DDRA_BIT.BIT2 #
def
ine
DDRA_3 DDRA_BIT.BIT3 #
def
ine
DDRA_4 DDRA_BIT.BIT4 #
def
ine
DDRA_5 DDRA_BIT.BIT5 #
def
ine
DDRA_6 DDRA_BIT.BIT6 #
def
ine
DDRA_7 DDRA_BIT.BIT7 #endif #if
def
DDRB #
def
ine
DDRB_0 DDRB_BIT.BIT0 #
def
ine
DDRB_1 DDRB_BIT.BIT1 #
def
ine
DDRB_2 DDRB_BIT.BIT2 #
def
ine
DDRB_3 DDRB_BIT.BIT3 #
def
ine
DDRB_4 DDRB_BIT.BIT4 #
def
ine
DDRB_5 DDRB_BIT.BIT5 #
def
ine
DDRB_6 DDRB_BIT.BIT6 #
def
ine
DDRB_7 DDRB_BIT.BIT7 #endif #if
def
DDRC #
def
ine
DDRC_0 DDRC_BIT.BIT0 #
def
ine
DDRC_1 DDRC_BIT.BIT1 #
def
ine
DDRC_2 DDRC_BIT.BIT2 #
def
ine
DDRC_3 DDRC_BIT.BIT3 #
def
ine
DDRC_4 DDRC_BIT.BIT4 #
def
ine
DDRC_5 DDRC_BIT.BIT5 #
def
ine
DDRC_6 DDRC_BIT.BIT6 #
def
ine
DDRC_7 DDRC_BIT.BIT7 #endif #if
def
DDRD #
def
ine
DDRD_0 DDRD_BIT.BIT0 #
def
ine
DDRD_1 DDRD_BIT.BIT1 #
def
ine
DDRD_2 DDRD_BIT.BIT2 #
def
ine
DDRD_3 DDRD_BIT.BIT3 #
def
ine
DDRD_4 DDRD_BIT.BIT4 #
def
ine
DDRD_5 DDRD_BIT.BIT5 #
def
ine
DDRD_6 DDRD_BIT.BIT6 #
def
ine
DDRD_7 DDRD_BIT.BIT7 #endif #if
def
DDRE #
def
ine
DDRE_0 DDRE_BIT.BIT0 #
def
ine
DDRE_1 DDRE_BIT.BIT1 #
def
ine
DDRE_2 DDRE_BIT.BIT2 #
def
ine
DDRE_3 DDRE_BIT.BIT3 #
def
ine
DDRE_4 DDRE_BIT.BIT4 #
def
ine
DDRE_5 DDRE_BIT.BIT5 #
def
ine
DDRE_6 DDRE_BIT.BIT6 #
def
ine
DDRE_7 DDRE_BIT.BIT7 #endif #if
def
DDRF #
def
ine
DDRF_0 DDRF_BIT.BIT0 #
def
ine
DDRF_1 DDRF_BIT.BIT1 #
def
ine
DDRF_2 DDRF_BIT.BIT2 #
def
ine
DDRF_3 DDRF_BIT.BIT3 #
def
ine
DDRF_4 DDRF_BIT.BIT4 #
def
ine
DDRF_5 DDRF_BIT.BIT5 #
def
ine
DDRF_6 DDRF_BIT.BIT6 #
def
ine
DDRF_7 DDRF_BIT.BIT7 #endif #if
def
DDRG #
def
ine
DDRG_0 DDRG_BIT.BIT0 #
def
ine
DDRG_1 DDRG_BIT.BIT1 #
def
ine
DDRG_2 DDRG_BIT.BIT2 #
def
ine
DDRG_3 DDRG_BIT.BIT3 #
def
ine
DDRG_4 DDRG_BIT.BIT4 #
def
ine
DDRG_5 DDRG_BIT.BIT5 #
def
ine
DDRG_6 DDRG_BIT.BIT6 #
def
ine
DDRG_7 DDRG_BIT.BIT7 #endif /*****************************************************************************/ #if
def
PINA #
def
ine
PINA_0 PINA_BIT.BIT0 #
def
ine
PINA_1 PINA_BIT.BIT1 #
def
ine
PINA_2 PINA_BIT.BIT2 #
def
ine
PINA_3 PINA_BIT.BIT3 #
def
ine
PINA_4 PINA_BIT.BIT4 #
def
ine
PINA_5 PINA_BIT.BIT5 #
def
ine
PINA_6 PINA_BIT.BIT6 #
def
ine
PINA_7 PINA_BIT.BIT7 #endif #if
def
PINB #
def
ine
PINB_0 PINB_BIT.BIT0 #
def
ine
PINB_1 PINB_BIT.BIT1 #
def
ine
PINB_2 PINB_BIT.BIT2 #
def
ine
PINB_3 PINB_BIT.BIT3 #
def
ine
PINB_4 PINB_BIT.BIT4 #
def
ine
PINB_5 PINB_BIT.BIT5 #
def
ine
PINB_6 PINB_BIT.BIT6 #
def
ine
PINB_7 PINB_BIT.BIT7 #endif #if
def
PINC #
def
ine
PINC_0 PINC_BIT.BIT0 #
def
ine
PINC_1 PINC_BIT.BIT1 #
def
ine
PINC_2 PINC_BIT.BIT2 #
def
ine
PINC_3 PINC_BIT.BIT3 #
def
ine
PINC_4 PINC_BIT.BIT4 #
def
ine
PINC_5 PINC_BIT.BIT5 #
def
ine
PINC_6 PINC_BIT.BIT6 #
def
ine
PINC_7 PINC_BIT.BIT7 #endif #if
def
PIND #
def
ine
PIND_0 PIND_BIT.BIT0 #
def
ine
PIND_1 PIND_BIT.BIT1 #
def
ine
PIND_2 PIND_BIT.BIT2 #
def
ine
PIND_3 PIND_BIT.BIT3 #
def
ine
PIND_4 PIND_BIT.BIT4 #
def
ine
PIND_5 PIND_BIT.BIT5 #
def
ine
PIND_6 PIND_BIT.BIT6 #
def
ine
PIND_7 PIND_BIT.BIT7 #endif #if
def
PINE #
def
ine
PINE_0 PINE_BIT.BIT0 #
def
ine
PINE_1 PINE_BIT.BIT1 #
def
ine
PINE_2 PINE_BIT.BIT2 #
def
ine
PINE_3 PINE_BIT.BIT3 #
def
ine
PINE_4 PINE_BIT.BIT4 #
def
ine
PINE_5 PINE_BIT.BIT5 #
def
ine
PINE_6 PINE_BIT.BIT6 #
def
ine
PINE_7 PINE_BIT.BIT7 #endif #if
def
PINF #
def
ine
PINF_0 PINF_BIT.BIT0 #
def
ine
PINF_1 PINF_BIT.BIT1 #
def
ine
PINF_2 PINF_BIT.BIT2 #
def
ine
PINF_3 PINF_BIT.BIT3 #
def
ine
PINF_4 PINF_BIT.BIT4 #
def
ine
PINF_5 PINF_BIT.BIT5 #
def
ine
PINF_6 PINF_BIT.BIT6 #
def
ine
PINF_7 PINF_BIT.BIT7 #endif #if
def
PING #
def
ine
PING_0 PING_BIT.BIT0 #
def
ine
PING_1 PING_BIT.BIT1 #
def
ine
PING_2 PING_BIT.BIT2 #
def
ine
PING_3 PING_BIT.BIT3 #
def
ine
PING_4 PING_BIT.BIT4 #
def
ine
PING_5 PING_BIT.BIT5 #
def
ine
PING_6 PING_BIT.BIT6 #
def
ine
PING_7 PING_BIT.BIT7 #endif #endif /*******************************************************************************/
glsl version 300 es 预处理
参考链接: GLSL_ES_Specification_3.00 预处理 #version #version 300 es //定义glsl版本 #if #
def
ine
#un
def
#if #if
def
#ifn
def
#else #elif #endif #
def
ine
USE_LIGHT #
def
ine
LIGHT_NUMBER 10 ... #if
def
USE_LIGHT .... #else ... #endif #error #pragma #pragma STDGL invariant(all) //保证所有输出变量必须精确一致 //但会降低optimize效率,降低性
#
def
ine
和#if
def
的使用
之前没有写过什么大工程,所以没有怎么关注过条件编译。今天在看代码的时候发现里面用到了#
def
ine
和#if
def
来调试代码。于是就看了一下。顺便再做个笔记。 先介绍一下条件编译: 条件编译是根据实际定义的宏(可以认为是某一类条件)进行代码静态编译的手段。可以根据表达式的值或者某个特定宏是否被定义来确定编译条件。 在看几个预编译指令(预编译指令很多,这次只介绍用到的三个): #...
【条件编译命令】#
def
ine
#un
def
#if
def
#ifn
def
#if 1 #if 0 #elif #else #endif
def
ine
d用法和作用详解
【条件编译命令】#
def
ine
#un
def
#if
def
#ifn
def
#if 1 #if 0 #elif #else #endif
def
ine
d用法和作用详解 1.C语言中条件编译命令的作用: #
def
ine
定义一个预处理宏 #un
def
取消宏定义 #if 编译预处理中的条件命令,相当于C语法中的if语句 #if
def
判断某个宏是否被定义 #ifn
def
判断某个宏是否未被定义 #elif 若#if, #if
def
, #ifn
def
或前
C/C++预处理指令#
def
ine
,#if
def
,#ifn
def
,#endif…
管理C/C++预处理指令#
def
ine
,#if
def
,#ifn
def
,#endif…本文主要记录了C/C++预处理指令,常见的预处理指令如下:#空指令,无任何效果#include包含一个源代码文件#
def
ine
定义宏#un
def
取消已定义的宏#if如果给定条件为真,则编译下面代码#if
def
如果宏已经定义,则编译下面代码#ifn
def
如果宏没有定义,则编译下面代码#elif如果前面的#if给定条件...
C++ Builder
13,873
社区成员
102,696
社区内容
发帖
与我相关
我的任务
C++ Builder
C++ Builder相关内容讨论区
复制链接
扫一扫
分享
社区描述
C++ Builder相关内容讨论区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章