Closed toshibochan closed 6 years ago
This has been happening to a lot of people with upgraded raspbian. Some people have suggested adding std:: before min and max but I suspect that just masks an issue with including port.h. I changed the ifdef that wraps port.h to see if that fixes it. Try updating from master and seeing if it builds.
On Fri, Sep 8, 2017 at 4:04 AM, toshibochan notifications@github.com wrote:
i trying install but i getting error.
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" Weather.cpp: In member function ‘int Weather::GetScale(const Weather::ReturnVals&) const’: Weather.cpp:182: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:182: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
please help
thanks
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/99, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKE3BqWNLwJomEdl-8URgGyAMLFTqeuks5sgPT9gaJpZM4PQ1KL .
change in port.h?
this way?
i change in port.h but no work
no i mean i made a code change.download the master from github. revert that change you made.
On Fri, Sep 8, 2017 at 2:51 PM, toshibochan notifications@github.com wrote:
i change in port.h but no work
ifndef std::max
define max(a,b) (((a) > (b)) ? (a) : (b))
endif
ifndef std::min
define min(a,b) (((a) < (b)) ? (a) : (b))
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/99#issuecomment-328185398, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKE3PRSsWW79kKDCdoKD4CuP1Brzibbks5sgYyqgaJpZM4PQ1KL .
i did new download now. but same.
wget https://github.com/rszimm/sprinklers_pi/archive/v1.1.1.tar.gz tar -xzvf v1.1.1.tar.gz cd 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" Weather.cpp: In member function ‘int Weather::GetScale(const Weather::ReturnVals&) const’: Weather.cpp:182: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:182: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
Sorry for the misunderstanding. I haven't tagged a new version yet please do this to checkout a new copy from github: git clone https://github.com/rszimm/sprinklers_pi.git
it should check out to a directory called sprinklers_pi (no version #). cd there and build as normal.
On Fri, Sep 8, 2017 at 3:18 PM, toshibochan notifications@github.com wrote:
i did new download now. but same.
wget https://github.com/rszimm/sprinklers_pi/archive/v1.1.1.tar.gz tar -xzvf v1.1.1.tar.gz cd 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" Weather.cpp: In member function ‘int Weather::GetScale(const Weather::ReturnVals&) const’: Weather.cpp:182: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:182: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
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/99#issuecomment-328191240, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKE3F21LhGkP9Z-DThtBn-BE5LsC0ioks5sgZL6gaJpZM4PQ1KL .
same result
I'm not going to be able to help until i get a pi with the updated raspbian on it to try compiling. Because making the changes that others suggest fixed their issues does not compile in the old version of raspbian.
On Fri, Sep 8, 2017 at 3:56 PM, toshibochan notifications@github.com wrote:
same result
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rszimm/sprinklers_pi/issues/99#issuecomment-328199070, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKE3GwZimBmBs-Xge1ZiNHnQ_pZG0_Nks5sgZvSgaJpZM4PQ1KL .
thanks @nhorvath! let me know when you fix!!!
Same issue for me as well. If you want I can give you SSH access to my Pi B+ Rev 02 with the latest Raspbian Stretch on there. I'd love to get this working and I am far too lazy to roll my own solution and would much rather donate to your project. heheh
Edit: Just to clarify, I did a git clone of the /sprinkler_pi and got the same results about min and max not being declared in the this scope.
Sorry I haven't been around much on this project. Many many many huge thanks to @nhorvath for picking up the slack. This issue has been lurking for a while now as gnu really doesn't like people using max/min macros and even goes as far as to undef them in c++config.h. With v6 of the toolchain this actually came to a head depending on the order you #include stuff. It's been bad practice for a while and it's just luck that we haven't had this issue crop up before. Major projects like mysql had this problem probably a decade ago.
Anyway, I redefined the macros from min/max to spi_min/spi_max. Should work with all (reasonable) versions of g++. I checked it into master. Let me know if you all see it working and I'll create a 1.1.2 install tarball.
new update fix the error! thank you very much!!!!
Yup! Fixed it here too! Thank you much!
I don't see a donate button anywhere, I want to toss some money in the hat, so you can buy yourself a beer or something!
i trying install but i getting error.
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" Weather.cpp: In member function ‘int Weather::GetScale(const Weather::ReturnVals&) const’: Weather.cpp:182: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:182: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
please help
thanks