DrGeoff / cec_simplest

The simplest example program to show CEC in action
The Unlicense
20 stars 5 forks source link

compile error #2

Closed Electrik-rich546456 closed 4 years ago

Electrik-rich546456 commented 4 years ago

Hi Compile error on Ubuntu 19

error: unrecognized command line option ‘-mfpu=vfp’ g++: error: unrecognized command line option ‘-mfloat-abi=hard’

How do I compile this on Ubuntu PC I have the pulse-eight cec adaptor

DrGeoff commented 4 years ago

The current build command is for Raspbian OS on a Raspberry Pi. I don't have your OS and hardware to test on, so this is just a guess. Try using

g++ -std=c++1z -fPIC -g -Wall -lcec -ldl cec-simplest.cpp -o cec-simplest

Electrik-rich546456 commented 4 years ago

This is what i got when I typed that command

`g++ -std=c++1z -fPIC -g -Wall -lcec -ldl cec-simplest.cpp -o cec-simplest ````

cec-simplest.cpp: In function ‘int main(int, char**)’: cec-simplest.cpp:61:77: error: no matching function for call to ‘min(std::__cxx11::basic_string::size_type, unsigned int)’ 61 | copy(cec_config.strDeviceName, std::min(devicename.size(),13u) ); | ^

In file included from /usr/include/c++/9/bits/char_traits.h:39, from /usr/include/c++/9/string:40, from /usr/include/libcec/cectypes.h:61, from /usr/include/libcec/cec.h:37, from cec-simplest.cpp:5: /usr/include/c++/9/bits/stl_algobase.h:198:5: note: candidate: ‘template constexpr const _Tp& std::min(const _Tp&, const _Tp&)’ 198 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/9/bits/stl_algobase.h:198:5: note: template argument deduction/substitution failed: cec-simplest.cpp:61:77: note: deduced conflicting types for parameter ‘const _Tp’ (‘long unsigned int’ and ‘unsigned int’) 61 | copy(cec_config.strDeviceName, std::min(devicename.size(),13u) ); | ^

In file included from /usr/include/c++/9/bits/char_traits.h:39, from /usr/include/c++/9/string:40, from /usr/include/libcec/cectypes.h:61, from /usr/include/libcec/cec.h:37, from cec-simplest.cpp:5: /usr/include/c++/9/bits/stl_algobase.h:246:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’ 246 | min(const _Tp& a, const _Tp& __b, _Compare comp) | ^~~ /usr/include/c++/9/bits/stl_algobase.h:246:5: note: template argument deduction/substitution failed: cec-simplest.cpp:61:77: note: deduced conflicting types for parameter ‘const _Tp’ (‘long unsigned int’ and ‘unsigned int’) 61 | copy(cec_config.strDeviceName, std::min(devicename.size(),13u) ); | ^

In file included from /usr/include/c++/9/algorithm:62, from cec-simplest.cpp:14: /usr/include/c++/9/bits/stl_algo.h:3444:5: note: candidate: ‘template constexpr _Tp std::min(std::initializer_list<_Tp>)’ 3444 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/9/bits/stl_algo.h:3444:5: note: template argument deduction/substitution failed: cec-simplest.cpp:61:77: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘long unsigned int’ 61 | copy(cec_config.strDeviceName, std::min(devicename.size(),13u) ); | ^

In file included from /usr/include/c++/9/algorithm:62, from cec-simplest.cpp:14: /usr/include/c++/9/bits/stl_algo.h:3450:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)’ 3450 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/9/bits/stl_algo.h:3450:5: note: template argument deduction/substitution failed: cec-simplest.cpp:61:77: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘long unsigned int’ 61 | copy(cec_config.strDeviceName, std::min(devicename.size(),13u) );

Electrik-rich546456 commented 4 years ago

Ii have Intel Core i5 CPU 650 what other info do you need ?

DrGeoff commented 4 years ago

git pull to get a fix for that std::min type error problem. Then try compiling with g++ -std=c++1z -fPIC -g -Wall cec-simplest.cpp -lcec -ldl -o cec-simplest

Electrik-rich546456 commented 4 years ago

How do I git pull ??

Electrik-rich546456 commented 4 years ago

Ok so I downloaded the master zip again and ran above command...

g++ -std=c++1z -fPIC -g -Wall cec-simplest.cpp -lcec -ldl -o cec-simplest
$ cec-simplest
cec-simplest: command not found
$ ./cec-simplest

And Now just sits there with a flashing cursor. What is it suppose to do ? cec-client still works and displays the stream of info...

Electrik-rich546456 commented 4 years ago

Ive just looked at the code and I think I see. Is it suppose to read out keys pressed from the Tv remote ?

my connections might make it easier to understand my project. < TV> ------->------CEC DEV>---->----<PC

Can i use this to run in the background and listen for function keys F8-F12 press and do things like change tv source or turn tv on and off the code would also need to detect TV change audio source and if source switched away from PC 1 don't turn TV off,

  1. if source is on PC then monitor for screen saver activity on the dbus and if screen turns off sent tv to sleep. or off via cec.

I have all these functions working using cec-client in bash scripts but i wanted to integrate it into a single python script using the py library but didn't work, then I found this project and thought there is no harm in asking. Would you be able to help me?

DrGeoff commented 4 years ago

This repository is about introducing the libcec C/C++ interface in the simplest way possible. It simply prints out TV remote key presses.

I think your project is possible with libcec but I don't have the time to write your code.

Best wishes, Geoff