现在的位置: 首页 > 综合 > 正文

全局变量的用法

2013年01月11日 ⁄ 综合 ⁄ 共 277字 ⁄ 字号 评论关闭
 三个文件pc_main.h,modpc_com.h,modpc_com.cpp

modpc_com.h中的内容
extern char com_file_name[30];//for comminication
extern int g_mqid;//it is the message queue id

modpc_com.cpp中的内容
#include "modpc_com.h"
int g_mqid=5;
char com_file_name[30]="shared_file";

pc_main.cpp中的内容
#include "modpc_com.h"
int main()
{
cout

}

抱歉!评论已关闭.