PlainFFT library error .... time_t

Hello!

I’m new to the particle photon and I’ve added the PlainFFT library to a new project. I’m receiving the following errors:

/usr/local/gcc-arm-embedded/arm-none-eabi/include/sys/types.h:122:18: error: conflicting declaration 'typedef long int time_t'
 typedef _TIME_T_ time_t;


lib/PlainFFT/src/time.h:116:22: error: 'time_t' has a previous declaration as 'typedef uint32_t time_t'
     typedef uint32_t time_t;

I’m using the build.particle.io web based IDE.

I really need an FFT library for my photon.

Any thoughts? Am I doing anything wrong?

Thanks!

1 Like

I guess you want to define a new type _TIME_T_ but your code does attempt to redefine the already defined time_t (as the error message clearly states).

Have a look at the correct syntax of typedef
http://en.cppreference.com/w/cpp/language/typedef

Not sure what to change considering I haven’t written code yet. Here is my sketch so far:

// This #include statement was automatically added by the Particle IDE.
#include <PlainFFT.h>

void setup() {

}

void loop() {

}

You’d need to swap the new type name and the “native” type around (probably in the library file lib/PlainFFT/src/time.h)

// instead of
// typedef _TIME_T_ time_t;
// try this
typedef time_t _TIME_T_;

I assumed the same. However, I cannot figure out how to edit this file using the web IDE.

This issue is still a problem for me. Does anyone have any thoughts?

@psimin - there is too much cruft in there. I eliminated all the extra *.h files except for the PlainFFT.h and it compiles fine with an empty setup() and loop().

Are you able to download a copy of the PlainFFT lib using the Particle CLI (command line)? If so, make a local copy. Rename it a bit as the original name is owned by someone else. Eradicate the extra dot.h files. Upload a private copy and then point to your local copy.

$ particle compile photon

Compiling code for photon

Including:
    src/PlainFFTtest.ino
    project.properties
attempting to compile firmware 
downloading binary from: /v1/binaries/598be1f7e89fcb4de3dd0e7b
saving to: photon_firmware_1502339569618.bin
Memory use: 
   text	   data	    bss	    dec	    hex	filename
   4540	      8	   1436	   5984	   1760	/workspace/target/workspace.elf

Compile succeeded.
Saved firmware to: /Users/cermak/Particle/projects/PlainFFTtest/photon_firmware_1502339569618.bin
$ ls -lR PlainFFTtest/
total 32
-rw-r--r--  1 cermak  staff  2677 Aug  9 19:00 README.md
-rw-r--r--  1 cermak  staff  4548 Aug  9 20:32 photon_firmware_1502339569618.bin
-rw-r--r--  1 cermak  staff    48 Aug  9 20:32 project.properties
drwxr-xr-x  3 cermak  staff   102 Aug  9 19:01 src

PlainFFTtest/src:
total 8
-rw-r--r--  1 cermak  staff  341 Aug  9 19:01 PlainFFTtest.ino

$ cat PlainFFTtest/project.properties 
name=PlainFFTtest
dependencies.PlainFFTrc=0.4.6

The library should look like:

$ ls -lR libraries/PlainFFTrc\@0.4.6
total 24
-rw-r--r--  1 cermak  staff    14 Aug  9 18:59 README.md
-rw-r--r--  1 cermak  staff   104 Aug  9 19:11 library.properties
-rw-r--r--  1 cermak  staff  1078 Aug  9 18:59 license
drwxr-xr-x  4 cermak  staff   136 Aug  9 19:10 src

libraries/PlainFFTrc@0.4.6/src:
total 24
-rw-r--r--  1 cermak  staff  5480 Aug  9 18:59 PlainFFT.cpp
-rw-r--r--  1 cermak  staff  1331 Aug  9 19:10 PlainFFT.h