Gabriellavoura/Mqtt-and-Sim800-900

fatal error: Time.h: No such file or directory compilation terminated.

lwh456789 opened this issue · 28 comments

为什么会出现这种情况,该怎么解决
fatal error: Time.h: No such file or directory
compilation terminated.

D:\Arduino\hardware\tools\avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10603 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -ID:\Arduino\hardware\arduino\avr\cores\arduino -ID:\Arduino\hardware\arduino\avr\variants\mega C:\Users\ADMINI1\AppData\Local\Temp\build789388500709334239.tmp\mqtt_basic_pub_and_sub.cpp -o C:\Users\ADMINI1\AppData\Local\Temp\build789388500709334239.tmp\mqtt_basic_pub_and_sub.cpp.o

Hi, make sure that you have installed all the dependencies, like time.h from Arduino: https://playground.arduino.cc/Code/Time/

https://github.com/PaulStoffregen/Time

Be attentive to the hierarchy of folders when installing the dependencies.

Unzip all folders in your Arduino libraries folder, then set in the "tools" menu -> board 2560 option.

try the sketch in "example" folder.

Please, if possible write in English, hope i helped you.

为什么会出现这种情况,该怎么解决
fatal error: Time.h: No such file or directory
compilation terminated.

I replaced the original time.h with the new one that you provided me, but the original problem still appeared after compiling, and # include <Time. h >; delete, the problem after compilation is
fatal error: sim800Client.h: No such file or directory compilation terminated.

#include <Time.h> #include <sim800Client.h> #include <PubSubClientHotlog.h> #include <TimeAlarms.h>

I wonder if the problem is the Arduino version. Mine is 1.6.3

I wonder if the problem is the Arduino version. Mine is 1.6.3

This look like a problem with the Arduino installation or compiler, just to verify, you must have this folder organization:

windows:
C:\Documents\Arduino\libraries\ < paste here the sim800, TimeAlarms, Time-Master, PubSub >

and

C:\Program Files (x86)\Arduino\libraries\ < paste here the sim800, TimeAlarms, Time-Master, PubSub >

Screenshot (169)

I have tested to your Arduino version(1.6.3) and the sketch runs normally

What is your operational system?

win7 64

I'm using the program our friend here providedhttps://github.com/Gabriellavoura/Mqtt-and-Sim800-900/tree/master/GPRS%20with%20MQTT%20for%20Sim800and900/Example/mqtt_basic_pub_and_sub

Ok, please verify if in your Arduino IDE this is showing:

Screenshot (170)
Screenshot (171)

You must have this, if not probably you installation of Arduino IDE is wrong

Can you compile it successfully

I have made a downgrade to your version of Arduino IDE and i tried to reproduce your environment here. But the sketch works fine.

as you can see here, the sketch has success on compile:
Screenshot (173)

Maybe is something with the Encoding or character conversion of UTF-8 to UTF-32?

Can you compile it successfully?

Maybe I should try downloading the Arduino again

Maybe I should try downloading the Arduino again

Please try rename #include <Time.h>

to #include <TimeLib.h>

Searching here for a solution, i found that some win versions ignores the CamelCase notation, and cause conflict with time.h from C with Time.h from Arduino.

I've now re-downloaded the latest version of Arduino, and when I re-added libraries, it said it was invalid

it was invalid

This error is because the new version does not accept space in libraries name, just copy the content of zip file to your libraries folder in your documents like that:

Screenshot (168)

Then open the sketch on example folder.

what should I do?

I've already added this, but the file is not shown in the example

I've already added this, but the file is not shown in the example

After put just the content of "GPRS with MQTT for Sim800and900" on your documents/Arduino/libraries/
Open the sketch manually, on IDE Arduino go to File -> Open - > Examples -> Mqtt_basic_pub_and_sub -> mqtt_basic_pub_and_sub.ino

Please make sure that you paste Just the content of folder in your libraries:

Screenshot (175)

If you done that correctly you will have:

Screenshot (176)

That's exactly what I did, but only four other folders appear in the Example, and the Example folder doesn't appear

What are the common reasons for invalid libraries

That's exactly what I did, but only four other folders appear in the Example, and the Example folder doesn't appear

Try opening the sketch manually.

What are the common reasons for invalid libraries

Wrong paths 😢 . That is strange, because i have done the same things here in my computer, and that is ok.

捕获

In this print, the path is wrong, because the folders are inside a "Mqtt-and-Sim800-900-master"
folder.

That's exactly what I did, but only four other folders appear in the Example, and the Example folder doesn't appear

After change, always restart your Arduino IDE. Don’t forget this, as it doesn’t automatically detect changes in the file architecture.

Thank you, my friend. I've compiled it. Thank you for your guidance

Thank you, my friend. I've compiled it. Thank you for your guidance

I will work to update this project soon as possible, now I'm going to sleep, is 6 Am here in Brazil.

If you have any issue please leave a commt.

Happy for you, You are welcome! 😄