DFS1USn2cJL 发表于 2020-1-2 08:42:36

请问这是怎么回事











C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino: In function 'void openLight()':

sketch_jan02a:6: error: 'D2' was not declared in this scope

#define BEDROOD_LIGHTD2

                        ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino:30:16: note: in expansion of macro 'BEDROOD_LIGHT'

   digitalWrite(BEDROOD_LIGHT, HIGH);

                ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino: In function 'void closeLight()':

sketch_jan02a:6: error: 'D2' was not declared in this scope

#define BEDROOD_LIGHTD2

                        ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino:34:16: note: in expansion of macro 'BEDROOD_LIGHT'

   digitalWrite(BEDROOD_LIGHT, LOW);

                ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino: In function 'void connectWiFi()':

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino:40:37: warning: invalid conversion from 'const char*' to 'char*' [-fpermissive]

   WiFi.begin(WIFI_SSID,WIFI_PASSWORD);

                                     ^

In file included from C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino:1:0:

C:\Users\acer\Desktop\arduino-1.8.3\libraries\WiFi\src/WiFi.h:79:9: note: initializing argument 1 of 'int WiFiClass::begin(char*, const char*)'

   int begin(char* ssid, const char *passphrase);

         ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino: In function 'void callback(char*, byte*, unsigned int)':

sketch_jan02a:74: error: 'client' was not declared in this scope

   client.publish(pubTopic,sendMseg);

   ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino: In function 'void ConnectAliyun()':

sketch_jan02a:78: error: 'client' was not declared in this scope

   while(!client.connected()){

          ^

sketch_jan02a:81: error: 'myAliyun' was not declared in this scope

   if(client.connect(myAliyun.client_id,myAliyun.username,myAliyun.password)){

                     ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino: In function 'void setup()':

sketch_jan02a:6: error: 'D2' was not declared in this scope

#define BEDROOD_LIGHTD2

                        ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino:94:11: note: in expansion of macro 'BEDROOD_LIGHT'

   pinMode(BEDROOD_LIGHT,OUTPUT);

         ^

sketch_jan02a:100: error: 'myAliyun' was not declared in this scope

   myAliyun.init(ALIYUN_SERVER,ProductKey,ClientId,DeviceName,DeviceSecret);

   ^

sketch_jan02a:102: error: 'client' was not declared in this scope

   client.setServer(myAliyun.mqtt_server,PORT);

   ^

C:\Users\acer\Desktop\sketch_jan02a\sketch_jan02a.ino: In function 'void loop()':

sketch_jan02a:118: error: 'client' was not declared in this scope

   if(!client.connected()){

       ^

sketch_jan02a:121: error: 'client' was not declared in this scope

   client.loop();

   ^

exit status 1
'D2' was not declared in this scope


gada888 发表于 2020-1-19 08:48:08

代码开头没有添加库文件

kylinpoet 发表于 2020-2-18 14:29:21

这个好,必须支持。

20060606 发表于 2020-8-5 05:32:40

没有添加库
页: [1]
查看完整版本: 请问这是怎么回事