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

fix: build failed with Qt5.11 and GCC8.3. #4

Merged
merged 1 commit into from
Sep 13, 2022
Merged

Conversation

re2zero
Copy link
Contributor

@re2zero re2zero commented Aug 17, 2022

the header ‘’ was included QDebug, if miss include functional or Debug, it would error: ‘std::function’ has not been declared.

Log: fix build failed issue.

the header ‘<functional>’ was include QDebug, if miss include functional or Debug, it would error: ‘std::function’ has not been declared.

Log: fix build failed issue.
@re2zero
Copy link
Contributor Author

re2zero commented Aug 17, 2022

build error logs:

:~/work/demo/scrcpy/QtScrcpy-new/build$ cmake ..
-- [QtScrcpy] Project QtScrcpy 0.0.0
-- [QtScrcpy] CPU_ARCH:x64
-- [QtScrcpy] BUILD_TYPE:RelWithDebInfo
-- [QtScrcpy] C++ compiler ID is: GNU
-- [QtScrcpy] Set warnings as error
-- [QtScrcpy] Qt version is: 5.11
-- multi config:QC_IS_MUTIL_CONFIG
-- [QtScrcpy] QSC_CPU_ARCH:x64
-- [QtScrcpyCore] QSC_DEPLOY_PATH: /home/doll/work/demo/scrcpy/QtScrcpy-new/QtScrcpy/../output/x64/RelWithDebInfo/$<0:>
-- Configuring done
-- Generating done
-- Build files have been written to: /home/doll/work/demo/scrcpy/QtScrcpy-new/build
doll@doll-PC:~/work/demo/scrcpy/QtScrcpy-new/build$ make
[  2%] Automatic MOC and UIC for target QtScrcpyCore
[  2%] Built target QtScrcpyCore_autogen
[  4%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/QtScrcpyCore_autogen/mocs_compilation.cpp.o
[  6%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/adb/adbprocessimpl.cpp.o
[  9%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/adb/adbprocess.cpp.o
[ 11%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/device.cpp.o
[ 13%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/controller/controller.cpp.o
[ 15%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/controller/bufferutil.cpp.o
[ 18%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/controller/inputconvert/inputconvertbase.cpp.o
[ 20%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/controller/inputconvert/inputconvertnormal.cpp.o
[ 22%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/controller/inputconvert/inputconvertgame.cpp.o
[ 25%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/controller/inputconvert/controlmsg.cpp.o
[ 27%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/controller/inputconvert/keymap/keymap.cpp.o
[ 29%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/controller/receiver/devicemsg.cpp.o
[ 31%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/controller/receiver/receiver.cpp.o
[ 34%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/decoder/avframeconvert.cpp.o
[ 36%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/decoder/decoder.cpp.o
[ 38%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/decoder/fpscounter.cpp.o
[ 40%] Building CXX object QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/decoder/videobuffer.cpp.o
In file included from /home/doll/work/demo/scrcpy/QtScrcpy-new/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.cpp:1:
/home/doll/work/demo/scrcpy/QtScrcpy-new/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.h:38:33: error: ‘std::function’ has not been declared
     void peekRenderedFrame(std::function<void(int width, int height, uint8_t* dataRGB32)> onFrame);
                                 ^~~~~~~~
/home/doll/work/demo/scrcpy/QtScrcpy-new/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.h:38:41: error: expected ‘,’ or ‘...’ before ‘<’ token
     void peekRenderedFrame(std::function<void(int width, int height, uint8_t* dataRGB32)> onFrame);
                                         ^
/home/doll/work/demo/scrcpy/QtScrcpy-new/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.cpp:110:42: error: variable or field ‘peekRenderedFrame’ declared void
 void VideoBuffer::peekRenderedFrame(std::function<void(int width, int height, uint8_t* dataRGB32)> onFrame)
                                          ^~~~~~~~
/home/doll/work/demo/scrcpy/QtScrcpy-new/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.cpp:110:42: error: ‘function’ is not a member of ‘std’
/home/doll/work/demo/scrcpy/QtScrcpy-new/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.cpp:110:42: note: ‘std::function’ is defined in header ‘<functional>; did you forget to ‘#include <functional>’?
/home/doll/work/demo/scrcpy/QtScrcpy-new/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.cpp:8:1:
+#include <functional>
 }
/home/doll/work/demo/scrcpy/QtScrcpy-new/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.cpp:110:42:
 void VideoBuffer::peekRenderedFrame(std::function<void(int width, int height, uint8_t* dataRGB32)> onFrame)
                                          ^~~~~~~~
/home/doll/work/demo/scrcpy/QtScrcpy-new/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.cpp:110:97: error: expression list treated as compound expression in functional cast [-fpermissive]
 void VideoBuffer::peekRenderedFrame(std::function<void(int width, int height, uint8_t* dataRGB32)> onFrame)
                                                                                                 ^
/home/doll/work/demo/scrcpy/QtScrcpy-new/QtScrcpy/QtScrcpyCore/src/device/decoder/videobuffer.cpp:110:51: error: expected primary-expression before ‘void’
 void VideoBuffer::peekRenderedFrame(std::function<void(int width, int height, uint8_t* dataRGB32)> onFrame)
                                                   ^~~~
cc1plus: error: unrecognized command line option ‘-Wno-c++17-extensions’ [-Werror]
cc1plus: error: unrecognized command line option ‘-Wno-nested-anon-types’ [-Werror]
cc1plus: all warnings being treated as errors
make[2]: *** [QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/build.make:300:QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/src/device/decoder/videobuffer.cpp.o] 错误 1
make[1]: *** [CMakeFiles/Makefile2:170:QtScrcpy/QtScrcpyCore/CMakeFiles/QtScrcpyCore.dir/all] 错误 2
make: *** [Makefile:91:all] 错误 2

In order to clear the highlight editing warning in Qt creator, I add '' in these header files.

@barry-ran barry-ran merged commit edd7bb4 into barry-ran:main Sep 13, 2022
barry-ran added a commit that referenced this pull request May 11, 2024
fix: build failed with Qt5.11 and GCC8.3.
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

Successfully merging this pull request may close these issues.

2 participants