radcheb / Adhan

High precision prayer time library
MIT License
13 stars 4 forks source link

I can't compile #15

Open suroh001 opened 5 years ago

suroh001 commented 5 years ago

Has anyone got a compiled version of the C library?

radcheb commented 5 years ago

Actually, the library needed a cmake plugin to compile, I added it to the sources, you can simply compile the code by running C/adhan/build.sh script. I also added some quick documentation in C/adhan/README.md.

radcheb commented 5 years ago

@suroh001 did it solve your problem? If so I will close the issue.

suroh001 commented 5 years ago

when i compile it spits this error out. any solutions?

/Users/habeeb/Downloads/Adhan-master 3/C/adhan/test/astronomical_test.cpp:189:17: fatal error: no member named 'isnan' in namespace 'std'; did you mean simply 'isnan'? EXPECT_TRUE(std::isnan(invalid)); ^~~~~~ isnan

suroh001 commented 5 years ago

ok so i just removed the std:: and it works but i have a question now, it compiles a .a file, i am currently trying to use the library on my arduino however arduino only supports .c and .cpp how do i convert it from .a to .c or .cpp

seesoe commented 4 years ago

any luck getting this to work with arduino? @suroh001

radcheb commented 4 years ago

@suroh001, @seesoe the library code is pure C (.c). Only tests uses .cpp files. If you follow these steps:

cd C/adhan/
./build.sh

It build a the library and you use directly file C/adhan/build/src/libadhan.a in your arduino project. If you still need C sources they are all in C/adhan/src and they are pure C.

seesoe commented 4 years ago

@radcheb arduino can't use static libraries. (from what I read up on)

seesoe commented 4 years ago

@radcheb I included the source files as Adhan.h and on arduino build I get

#include <math.h>

extern "C"
{
    #include "src/include/astronomical.h"
    #include "src/include/calculation_method.h"
    #include "src/include/calculation_parameters.h"
    #include "src/include/data_components.h"
    #include "src/include/double_utils.h"
    #include "src/include/prayer.h"
    #include "src/include/prayer_times.h"
    #include "src/include/solar_time.h"
}
In file included from C:\Users\seesoe\Documents\Arduino\libraries\Adhan/src/include/prayer_times.h:6:0,

                 from C:\Users\seesoe\Documents\Arduino\libraries\Adhan/Adhan.h:4,

C:\Users\seesoe\Documents\Arduino\libraries\Adhan/src/include/data_components.h:40:27: error: ambiguating new declaration of 'bool is_leap_year(int)'

 bool is_leap_year(int year);

                           ^

In file included from C:\Users\seesoe\Documents\Arduino\libraries\Adhan/src/include/data_components.h:6:0,

                 from C:\Users\seesoe\Documents\Arduino\libraries\Adhan/src/include/prayer_times.h:6,

c:\users\seesoe\appdata\local\arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2\avr\include\time.h:357:21: note: old declaration 'uint8_t is_leap_year(int16_t)'

     uint8_t         is_leap_year(int16_t year);