rszimm / sprinklers_pi

Sprinkling System Control Program for the Raspberry Pi
GNU General Public License v2.0
310 stars 100 forks source link

error on installation #97

Closed piesio98 closed 7 years ago

piesio98 commented 7 years ago

`pi@raspberrypi:~/sprinklers_pi-1.1.0 $ make -lwiringpi mkdir -p build gcc -O3 -Wall -fmessage-length=0 -MMD -MP -DLOGGING -DVERSION=\"1.1.0\" -MF"build/Event.d" -MT"build/Event.d" -c -o "build/Event.o" "Event.cpp"

gcc -O3 -Wall -fmessage-length=0 -MMD -MP -DLOGGING -DVERSION=\"1.1.0\" -MF"build/Logging.d" -MT"build/Logging.d" -c -o "build/Logging.o" "Logging.cpp"

gcc -O3 -Wall -fmessage-length=0 -MMD -MP -DLOGGING -DVERSION=\"1.1.0\" -MF"build/Weather.d" -MT"build/Weather.d" -c -o "build/Weather.o" "Weather.cpp"

Weather.cpp: In member function ‘int Weather::GetScale(const Weather::ReturnVals&) const’: Weather.cpp:181:69: error: ‘max’ was not declared in this scope const int adj = min(max(0, 100+humid_factor+temp_factor+rain_factor), 200); ^ Weather.cpp:181:75: error: ‘min’ was not declared in this scope const int adj = min(max(0, 100+humid_factor+temp_factor+rain_factor), 200); ^ Makefile:40: recipe for target 'build/Weather.o' failed make: *** [build/Weather.o] Error 1

paste same thing here https://pastebin.com/raw/XbahU4Hb

what's wrong before i'v done update, upgrade and everything from wiki installation

piesio98 commented 7 years ago

somebody ? pls

nhorvath commented 7 years ago

Ensure you have wiringpi installed. Try with release 1.1.1. I just downloaded the tar and compiled it on my pi without any issues.

pi@mirrorpi:~/tmp $ wget 'https://github.com/rszimm/sprinklers_pi/archive/v1.1.1.tar.gz'
--2017-08-31 09:49:39--  https://github.com/rszimm/sprinklers_pi/archive/v1.1.1.tar.gz
Resolving github.com (github.com)... 192.30.253.113, 192.30.253.112
Connecting to github.com (github.com)|192.30.253.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/rszimm/sprinklers_pi/tar.gz/v1.1.1 [following]
--2017-08-31 09:49:40--  https://codeload.github.com/rszimm/sprinklers_pi/tar.gz/v1.1.1
Resolving codeload.github.com (codeload.github.com)... 192.30.253.121, 192.30.253.120
Connecting to codeload.github.com (codeload.github.com)|192.30.253.121|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: ‘v1.1.1.tar.gz’

v1.1.1.tar.gz                                    [       <=>                                                                                       ] 214.52K   165KB/s   in 1.3s   

2017-08-31 09:49:41 (165 KB/s) - ‘v1.1.1.tar.gz’ saved [219669]

pi@mirrorpi:~/tmp $ tar xzf v1.1.1.tar.gz 
pi@mirrorpi:~/tmp $ ls
sprinklers_pi-1.1.1  v1.1.1.tar.gz
pi@mirrorpi:~/tmp $ cd sprinklers_pi-1.1.1/
pi@mirrorpi:~/tmp/sprinklers_pi-1.1.1 $ ls
core.cpp  Event.cpp  LICENSE.md   Logging.h  port.cpp  README.md  settings.cpp  sprinklers_init.d.sh  sprinklers_pi.logrotate  sysreset.h   Weather.h  web.cpp
core.h    Event.h    Logging.cpp  Makefile   port.h    scripts    settings.h    sprinklers_pi.cpp     sysreset.cpp             Weather.cpp  web        web.h
pi@mirrorpi:~/tmp/sprinklers_pi-1.1.1 $ make -lwiringpi
mkdir -p build
gcc -O3 -Wall -fmessage-length=0 -MMD -MP -DLOGGING -DVERSION=\"1.1.1\" -MF"build/Event.d" -MT"build/Event.d" -c -o "build/Event.o" "Event.cpp"
gcc -O3 -Wall -fmessage-length=0 -MMD -MP -DLOGGING -DVERSION=\"1.1.1\" -MF"build/Logging.d" -MT"build/Logging.d" -c -o "build/Logging.o" "Logging.cpp"
gcc -O3 -Wall -fmessage-length=0 -MMD -MP -DLOGGING -DVERSION=\"1.1.1\" -MF"build/Weather.d" -MT"build/Weather.d" -c -o "build/Weather.o" "Weather.cpp"
gcc -O3 -Wall -fmessage-length=0 -MMD -MP -DLOGGING -DVERSION=\"1.1.1\" -MF"build/core.d" -MT"build/core.d" -c -o "build/core.o" "core.cpp"
gcc -O3 -Wall -fmessage-length=0 -MMD -MP -DLOGGING -DVERSION=\"1.1.1\" -MF"build/port.d" -MT"build/port.d" -c -o "build/port.o" "port.cpp"
gcc -O3 -Wall -fmessage-length=0 -MMD -MP -DLOGGING -DVERSION=\"1.1.1\" -MF"build/settings.d" -MT"build/settings.d" -c -o "build/settings.o" "settings.cpp"
gcc -O3 -Wall -fmessage-length=0 -MMD -MP -DLOGGING -DVERSION=\"1.1.1\" -MF"build/sprinklers_pi.d" -MT"build/sprinklers_pi.d" -c -o "build/sprinklers_pi.o" "sprinklers_pi.cpp"
gcc -O3 -Wall -fmessage-length=0 -MMD -MP -DLOGGING -DVERSION=\"1.1.1\" -MF"build/sysreset.d" -MT"build/sysreset.d" -c -o "build/sysreset.o" "sysreset.cpp"
gcc -O3 -Wall -fmessage-length=0 -MMD -MP -DLOGGING -DVERSION=\"1.1.1\" -MF"build/web.d" -MT"build/web.d" -c -o "build/web.o" "web.cpp"
Building target: sprinklers_pi
g++  -o "sprinklers_pi" build/Event.o build/Logging.o build/Weather.o build/core.o build/port.o build/settings.o build/sprinklers_pi.o build/sysreset.o build/web.o -lsqlite3 -lwiringPi
Finished building target: sprinklers_pi

What's the output of gpio -v when you run it?

vliegher commented 7 years ago

I had the same problem. It seems to be a c++compiler issue but i fixed it. Used std::min and std::max instead of min and max. Also some incompatibility between integer and long integer. Fixed that as well. after that everything went well and Sprinkler_pi is working now.

nhorvath commented 7 years ago

You shouldn't have to make any code changes to get it to compile though. What is the output of gcc -v Mine says gcc version 4.9.2 (Raspbian 4.9.2-10)

On Thu, Aug 31, 2017 at 10:19 AM, vliegher notifications@github.com wrote:

I had the same problem. It seems to be a c++compiler issue but i fixed it. Used std::min and std::max instead of min and max. Also some incompatibility between integer and long integer. Fixed that as well. after that everything went well and Sprinkler_pi is working now.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/97#issuecomment-326309895, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKE3FzydvK5Cf1wqjEGfTuP8Gny0loWks5sdsDcgaJpZM4PDlk5 .

piesio98 commented 7 years ago

Gcc version 6.3.0 rasbian 6.3.0-18 wiring is instaled and uptodate

vliegher commented 7 years ago

It says gcc version 6.3.0 and raspbian 6.3.0-18+ripl

Op 31 aug. 2017, om 16:38 heeft Nick Horvath notifications@github.com het volgende geschreven:

You shouldn't have to make any code changes to get it to compile though. What is the output of gcc -v Mine says gcc version 4.9.2 (Raspbian 4.9.2-10)

On Thu, Aug 31, 2017 at 10:19 AM, vliegher notifications@github.com wrote:

I had the same problem. It seems to be a c++compiler issue but i fixed it. Used std::min and std::max instead of min and max. Also some incompatibility between integer and long integer. Fixed that as well. after that everything went well and Sprinkler_pi is working now.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/97#issuecomment-326309895, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKE3FzydvK5Cf1wqjEGfTuP8Gny0loWks5sdsDcgaJpZM4PDlk5 .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/97#issuecomment-326315970, or mute the thread https://github.com/notifications/unsubscribe-auth/AdtuHkvHqBm_qs4viH4WMSKTdH3NVMwEks5sdsVRgaJpZM4PDlk5.

piesio98 commented 7 years ago

still... 2017-08-31-160134_1024x768_scrot

nhorvath commented 7 years ago

the macros are defined in port.h i don't know why it would not be loading them as it is included in Weather.cpp.

piesio98 commented 7 years ago

copied

ifndef max

define max(a,b) (((a) > (b)) ? (a) : (b))

endif

ifndef min

define min(a,b) (((a) < (b)) ? (a) : (b))

endif

to core.cpp, settings.cpp, weather.cpp aaand it seems working

nhorvath commented 7 years ago

It still concerns me... what about the other stuff in port.h is it being set properly?

piesio98 commented 7 years ago

no other errors

piesio98 commented 7 years ago

nvm... weather adjustments to 0... all is working properly

copied

ifndef max

define max(a,b) (((a) > (b)) ? (a) : (b))

endif

ifndef min

define min(a,b) (((a) < (b)) ? (a) : (b))

endif

to weather.cpp

ifndef min

define min(a,b) (((a) < (b)) ? (a) : (b))

endif

to core.cpp and settings.cpp

toshibochan commented 6 years ago

hi @piesio98 you can send me where you edit the file. ha having same error

toshibochan commented 6 years ago

@piesio98 in between where you paste this?

piesio98 commented 6 years ago

/web somewhere at the top, before main code starts.