0
我正在开发一个项目,我必须通过WiFi模块接收UDP数据包并进行处理。不过,我仍然是c/C++(Student)的初学者。 在我的主文件main.cpp中,我使用了UDPSocket类来初始化我的模块和服务器之间的通信。在C++中使用extern时出错
UDPSocket server(ð);
static void nsp_init()
{
NSDL_DEBUG("name: %s", endpoint_name);
server.open("xxx.xxx.xxx.xxx", xxxx);
NSDL_DEBUG("name: %s", endpoint_name);
NSDL_DEBUG("EP:%s\n", endpoint_name);
}
的问题是在我的processing.cpp文件,我想访问我在main.cpp中声明的类的实例RECV:
#include "ESP8266Interface.h"
#include "UDPSocket.h"
extern Serial pc;
extern ESP8266Interface eth;
extern UDPSocket server(ð); //Am getting an error for using this
extern char endpoint_name[16];
extern uint8_t ep_type[];
extern uint8_t lifetime_ptr[];
我的问题是如何能我使用相同的UDPSocket服务器(& eth)我在我的主类中声明?
我真的很感激您的输入...