error when compiling with c++ library

Hello, I’m trying to compile a file which has an

#include “dmpmpu.h”

. I have that library in my Arduno/libraries folder, but that last file has

#include
#include <sys/time.h>

Now those files are at /usr/include/sys/time.h and /usr/include/c++/4.2.1/cmath, but when I compile I get the errors

/Users/sebamenabar/Documents/Arduino/libraries/mpudmp/mpudmp.h:31:17: fatal error: cmath: No such file or directory #include

/Users/sebamenabar/Documents/Arduino/libraries/mpudmp/mpudmp.h:32:22: fatal error: sys/time.h: No such file or directory #include <sys/time.h>

I’ve tried with symbolic links in every include folder of the Arduino app

/Applications/Arduino.app/Contents/Java/hardware/tools/avr/x86_64-apple-darwin12.6.0/avr/include
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/avr/include
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/include

But I still get that compiling error, I need help please!

sebamenabar:
those files are at /usr/include/sys/time.h and /usr/include/c++/4.2.1/cmath

Is that part of one of the hardware cores? If so which one? If not what is it?

You should be able to make it work by changing the includes to an absolute path but of course that's not an ideal situation both because it involves modifying the library and is not portable.

Some of the later versions of the IDE only allow you to include files with specific extensions. No extension is NOT a supported type.

PaulS:
No extension is NOT a supported type.

There is lots of Arduino code that includes files with no extension. We’d be seeing tons of posts from people having problems if that was true.

Try compiling this for Due:

#include <array>
void setup() {}
void loop() {}

pert:
Is that part of one of the hardware cores? If so which one? If not what is it?

You should be able to make it work by changing the includes to an absolute path but of course that’s not an ideal situation both because it involves modifying the library and is not portable.

What does hardware mean? I think that is the one that gcc uses, but the used by avr is inside the app folder, tried changing to absolute path, but cmath has another imports that also raise me errors and I don’t wanna mess with those files.

pert:
There is lots of Arduino code that includes files with no extension. We’d be seeing tons of posts from people having problems if that was true.

Try compiling this for Due:

#include <array>

void setup() {}
void loop() {}

I got an error, no such file or directory

sebamenabar:
What does hardware mean?

What do you have selected in Tools > Board menu?

sebamenabar:
I got an error, no such file or directory

Did you select Tools > Board > Arduino Due first? You would need to install the Arduino SAM Boards core if it's not already but that core isn't the only one with included files that have no extension. I know the esp8266 core has them also. I don't believe there are any in the Arduino AVR Boards core but you can create a file with no extension and include it if it's in the include path.

pert:
What do you have selected in Tools > Board menu?
Did you select Tools > Board > Arduino Due first? You would need to install the Arduino SAM Boards core if it's not already but that core isn't the only one with included files that have no extension. I know the esp8266 core has them also. I don't believe there are any in the Arduino AVR Boards core but you can create a file with no extension and include it if it's in the include path.

I have selected the Arduino Pro Mini 3.3V

I managed to fix the import errors by making a symlink of the folder /usr/include/* and /usr/include/c++/4.2.1/* in the path /Applications/Arduino.app/Contents/Java/hardware/tools/avr/avr/include but now I get the following error:

file included from /usr/include/sys/types.h:75:0,
from /Applications/Arduino.app/Contents/Java/hardware/tools/avr/avr/include/unistd.h:4,
from /usr/include/c++/4.2.1/bits/os_defines.h:61,
from /usr/include/c++/4.2.1/bits/c++config.h:41,
from /usr/include/c++/4.2.1/cmath:50,
from /Users/sebamenabar/Documents/Arduino/libraries/mpudmp/mpudmp.h:31,
from /Users/sebamenabar/Documents/Programacion/Universidad/innovacion/sketchbook/DMP_test/mpu9250test/mpu9250test.ino:36:
/usr/include/sys/cdefs.h:761:2: error: #error Unsupported architecture
#error Unsupported architecture
^
In file included from /usr/include/sys/types.h:78:0,
from /Applications/Arduino.app/Contents/Java/hardware/tools/avr/avr/include/unistd.h:4,
from /usr/include/c++/4.2.1/bits/os_defines.h:61,
from /usr/include/c++/4.2.1/bits/c++config.h:41,
from /usr/include/c++/4.2.1/cmath:50,
from /Users/sebamenabar/Documents/Arduino/libraries/mpudmp/mpudmp.h:31,
from /Users/sebamenabar/Documents/Programacion/Universidad/innovacion/sketchbook/DMP_test/mpu9250test/mpu9250test.ino:36:
/usr/include/machine/types.h:37:2: error: #error architecture not supported
#error architecture not supported
^
In file included from /usr/include/sys/_types.h:33:0,
from /usr/include/sys/types.h:79,
from /Applications/Arduino.app/Contents/Java/hardware/tools/avr/avr/include/unistd.h:4,
from /usr/include/c++/4.2.1/bits/os_defines.h:61,
from /usr/include/c++/4.2.1/bits/c++config.h:41,
from /usr/include/c++/4.2.1/cmath:50,
from /Users/sebamenabar/Documents/Arduino/libraries/mpudmp/mpudmp.h:31,
from /Users/sebamenabar/Documents/Programacion/Universidad/innovacion/sketchbook/DMP_test/mpu9250test/mpu9250test.ino:36:
/usr/include/machine/_types.h:34:2: error: #error architecture not supported
#error architecture not supported
^
In file included from /usr/include/sys/types.h:81:0,
from /Applications/Arduino.app/Contents/Java/hardware/tools/avr/avr/include/unistd.h:4,
from /usr/include/c++/4.2.1/bits/os_defines.h:61,
from /usr/include/c++/4.2.1/bits/c++config.h:41,
from /usr/include/c++/4.2.1/cmath:50,
from /Users/sebamenabar/Documents/Arduino/libraries/mpudmp/mpudmp.h:31,
from /Users/sebamenabar/Documents/Programacion/Universidad/innovacion/sketchbook/DMP_test/mpu9250test/mpu9250test.ino:36:
/usr/include/machine/endian.h:37:2: error: #error architecture not supported
#error architecture not supported

Where did you get the mpudmp library from? Post a link.

Where did this /usr/include/c++/4.2.1 stuff come from? It's clearly not part of the Arduino IDE, what is it?

pert:
Where did you get the mpudmp library from? Post a link.

pert:
Where did this /usr/include/c++/4.2.1 stuff come from? It's clearly not part of the Arduino IDE, what is it?

I think it is part of the GCC compiler

Thank you for your help, I think that the error that I'm having now means that the code does not work with the Arduino Pro Mini so now I'll work with other libraries

The unsupported architectures are coming from your GCC 4.2.1. Arduino AVR Boards, which is the hardware core for the Pro Mini, includes a version of GCC called AVR-GCC. It does have time.h but not cmath so you'd probably need to try to some porting to make the library work with Arduino AVR Boards' AVR-GCC. I think you'd be better off to find another library that's specifically for AVR.

Please update your StackOverflow question:

It's really not very respectful to cross-post because it causes people to waste their time trying to help you due to duplicated effort. At least you could be considerate enough to post the links to the duplicate posts.