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)我在我的主類中聲明?
我真的很感激您的輸入...