#ifndef CONFIGPARAM_H#define CONFIGPARAM_H#include CommonDefineh#include string全锟街诧拷锟斤拷锟斤拷锟斤拷struct ConfigParam 锟杰碉拷锟斤拷锟斤拷锟絀P string m_listen_ip; 锟杰碉拷锟斤拷锟斤拷锟絋CP锟剿匡拷 int m_listen_port; 锟杰碉拷锟斤拷锟斤
你需要在代码中添加using namespace std;来指定使用std命名空间。这样才能正确使用string类型。
修改后的代码如下:
#ifndef CONFIGPARAM_H
#define CONFIGPARAM_H
#include "CommonDefine.h"
#include <string>
using namespace std;
/*全局配置参数*/
struct ConfigParam
{
/*监听IP*/
string m_listen_ip;
/*监听端口*/
int m_listen_port;
/*websocket监听端口*/
int m_websocket_listen_port;
/*rpc服务端口*/
int m_rpc_port;
/*中心服务器IP-实时通信*/
string m_center_ip;
/*中心服务器端口-实时通信*/
int m_center_port;
/*最大连接数*/
int m_max_connect;
/*db连接池大小*/
int m_db_client_count;
/*center 连接池大小*/
int m_center_client_count;
/*io线程数*/
int m_io_thread_num;
/*工作线程数*/
int m_work_thread_num;
string m_redis_prev; //redis前缀
string sendToMessageCenter;
string m_redis_ip;
int m_redis_port;
string m_redis_auth;
RedisDeployModel m_redis_deploy_model;
string m_mq_host_ip;
string m_mq_user;
string m_mq_password;
string m_mq_vhost;
int m_mq_port;
string m_kafka_brokers;
string m_kafka_p2pmsg_topic;
string m_kafka_p2gmsg_topic;
/*发布队列名称*/
string m_publish_queue_name;
/*转发消息队列名称*/
string m_publish_transfer_msg_queue_name;
/*发布失败消息队列名称*/
string m_publish_failed_msg_queue_name;
/*发布拉取离线消息队列名称*/
string m_publish_pull_offline_msg_queue_name;
//群组消息队列名称,用于转发消息
string m_csc_msg_queue_name;
/*群组消息队列名称,用于失败重试*/
string m_csc_failed_msg_queue_name;
/*群组消息队列名称,用于离线消息*/
string m_publish_csc_offline_msg_queue_name;
/*消费队列名称*/
string m_consumer_queue_name;
/*主机名,用于RouterKey*/
string m_hostName;
/*群组消息队列名称*/
string m_mq_group_publish_queue_name;
//av db 配置
string m_av_dbhostname;
int m_av_dbport;
string m_av_dbuser;
string m_av_dbpasswd;
//频道获取接口地址
string m_callback_config_url;
string m_callback_config_queue;
//客户端上下线通知队列
string m_client_onoffline_to_account_queue;
//客户端下线通知队列
string m_client_offline_to_custome_queue;
//认证配置
string m_auth_code;
string m_appId;
string m_secret_key;
LoginMutexEnum m_login_mutex;
int m_login_web_count;
};
#endif
这样就可以正确使用string类型了。
原文地址: https://www.cveoy.top/t/topic/jgAR 著作权归作者所有。请勿转载和采集!