fix:build on ubuntu22.04 Qt5.12.12 error: ‘std::function’ has not bee… #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
OS: Ubuntu 22.04
Qt: 5.12.12
cmake version 3.22.1
build error:
[ 40%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/decoder/videobuffer.cpp.o
In file included from /home/ian/Desktop/QtScrcpy/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.cpp:1:
/home/ian/Desktop/QtScrcpy/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.h:38:33: error: ‘std::function’ has not been declared
38 | void peekRenderedFrame(std::function<void(int width, int height, uint8_t* dataRGB32)> onFrame);
| ^~~~~~~~
/home/ian/Desktop/QtScrcpy/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.h:38:41: error: expected ‘,’ or ‘...’ before ‘<’ token
38 | void peekRenderedFrame(std::function<void(int width, int height, uint8_t* dataRGB32)> onFrame);
| ^
/home/ian/Desktop/QtScrcpy/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.cpp:110:6: error: variable or field ‘peekRenderedFrame’ declared void
110 | void VideoBuffer::peekRenderedFrame(std::function<void(int width, int height, uint8_t* dataRGB32)> onFrame)
| ^~~~~~~~~~~
/home/ian/Desktop/QtScrcpy/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.cpp:110:42: error: ‘function’ is not a member of ‘std’
110 | void VideoBuffer::peekRenderedFrame(std::function<void(int width, int height, uint8_t* dataRGB32)> onFrame)
| ^~~~~~~~
/home/ian/Desktop/QtScrcpy/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.cpp:8:1: note: ‘std::function’ is defined in header ‘’; did you forget to ‘#include ’?
7 | #include "libavutil/imgutils.h"
+++ |+#include
8 | }
/home/ian/Desktop/QtScrcpy/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.cpp:110:97: error: expression list treated as compound expression in functional cast [-fpermissive]