Wiznet / RP2040-HAT-C

Ethernet Example for RP2040
64 stars 35 forks source link

Example build w5x00_mqtt_publish fails "time_t" unknown type #15

Open DarkTyr opened 1 year ago

DarkTyr commented 1 year ago

I have setup the rpi tool flow on windows 11 based on this article https://len42.github.io/rp2040-dev-setup.html which comes from the rpi_pico handbook. Running from a developer power shell I run into a compile issue for the MQTT_publish example that time_t is not defined.

I have followed the instructions from the https://github.com/Wiznet/RP2040-HAT-C/blob/main/getting_started.md under Ethernet Examples, cloned, applied the patch. I made a directory called build that I made in the RP2040-HAT-C directory and called the below commands:

cmake -G "NMake Makefiles" .. and nmake

Below is the output from nmake:

[ 50%] Building C object libraries/CMakeFiles/MQTT_FILES.dir/ioLibrary_Driver/Internet/MQTT/mqtt_interface.c.obj
[ 50%] Building C object libraries/CMakeFiles/MQTT_FILES.dir/ioLibrary_Driver/Internet/MQTT/MQTTClient.c.obj
[ 50%] Building C object libraries/CMakeFiles/MQTT_FILES.dir/ioLibrary_Driver/Internet/MQTT/MQTTPacket/src/MQTTConnectClient.c.obj
[ 50%] Building C object libraries/CMakeFiles/MQTT_FILES.dir/ioLibrary_Driver/Internet/MQTT/MQTTPacket/src/MQTTConnectServer.c.obj
[ 50%] Building C object libraries/CMakeFiles/MQTT_FILES.dir/ioLibrary_Driver/Internet/MQTT/MQTTPacket/src/MQTTDeserializePublish.c.obj
[ 50%] Building C object libraries/CMakeFiles/MQTT_FILES.dir/ioLibrary_Driver/Internet/MQTT/MQTTPacket/src/MQTTFormat.c.obj
[ 50%] Building C object libraries/CMakeFiles/MQTT_FILES.dir/ioLibrary_Driver/Internet/MQTT/MQTTPacket/src/MQTTPacket.c.obj
[ 50%] Building C object libraries/CMakeFiles/MQTT_FILES.dir/ioLibrary_Driver/Internet/MQTT/MQTTPacket/src/MQTTSerializePublish.c.obj
[ 50%] Building C object libraries/CMakeFiles/MQTT_FILES.dir/ioLibrary_Driver/Internet/MQTT/MQTTPacket/src/MQTTSubscribeClient.c.obj
[ 51%] Building C object libraries/CMakeFiles/MQTT_FILES.dir/ioLibrary_Driver/Internet/MQTT/MQTTPacket/src/MQTTSubscribeServer.c.obj
[ 51%] Building C object libraries/CMakeFiles/MQTT_FILES.dir/ioLibrary_Driver/Internet/MQTT/MQTTPacket/src/MQTTUnsubscribeClient.c.obj
[ 51%] Building C object libraries/CMakeFiles/MQTT_FILES.dir/ioLibrary_Driver/Internet/MQTT/MQTTPacket/src/MQTTUnsubscribeServer.c.obj
[ 51%] Linking C static library libMQTT_FILES.a
[ 51%] Built target MQTT_FILES
Scanning dependencies of target w5x00_mqtt_publish
[ 51%] Building C object examples/mqtt/publish/CMakeFiles/w5x00_mqtt_publish.dir/w5x00_mqtt_publish.c.obj
X:\rpi_pico\RP2040-HAT-C\examples\mqtt\publish\w5x00_mqtt_publish.c:96:8: error: unknown type name 'time_t'
   96 | static time_t millis(void);
      |        ^~~~~~
X:\rpi_pico\RP2040-HAT-C\examples\mqtt\publish\w5x00_mqtt_publish.c:235:8: error: unknown type name 'time_t'
  235 | static time_t millis(void)
      |        ^~~~~~
NMAKE : fatal error U1077: 'C:\GNUarm\12.2_mpacbti-bet1\bin\arm-none-eabi-gcc.exe' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\vs\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\vs\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.

I can and have fully built the pico-sdk examples before, so the build tool flow is there (command line and through VS Code). Any ideas what is missing?

ajwentzel commented 1 year ago

@DarkTyr did you ever figure this out? I just ran into the same problem.

DarkTyr commented 1 year ago

I did, all you need to do is add a time.h include to the main file.