Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error on installation #97

Closed
piesio98 opened this issue Aug 26, 2017 · 15 comments
Closed

error on installation #97

piesio98 opened this issue Aug 26, 2017 · 15 comments

Comments

@piesio98
Copy link

piesio98 commented Aug 26, 2017

`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
Copy link
Author

somebody ? pls

@nhorvath
Copy link
Collaborator

nhorvath commented Aug 31, 2017

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
Copy link

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
Copy link
Collaborator

nhorvath commented Aug 31, 2017 via email

@piesio98
Copy link
Author

piesio98 commented Aug 31, 2017

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

@vliegher
Copy link

vliegher commented Aug 31, 2017 via email

@piesio98
Copy link
Author

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

@nhorvath
Copy link
Collaborator

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
Copy link
Author

piesio98 commented Aug 31, 2017

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
Copy link
Collaborator

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

@piesio98
Copy link
Author

no other errors

@piesio98
Copy link
Author

piesio98 commented Sep 1, 2017

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

@piesio98 piesio98 closed this as completed Sep 4, 2017
@toshibochan
Copy link

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

@toshibochan
Copy link

@piesio98 in between where you paste this?

@piesio98
Copy link
Author

piesio98 commented Sep 9, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants