程式語言 - MinGW - OpenCV - 解決x86_64-w64-mingw32-gcc: error: unrecognized command line option -rdynamic問題



參考資訊:
https://cmake.cmake.narkive.com/VAND08gU/suppressing-rdynamic

問題:

Run Build Command(s):/usr/bin/make cmTC_b9db5/fast && /usr/bin/make  -f CMakeFiles/cmTC_b9db5.dir/build.make CMakeFiles/cmTC_b9db5.dir/build
    make[1]: Entering directory 'sample/build/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_b9db5.dir/testCCompiler.c.o
    /usr/bin/x86_64-w64-mingw32-gcc    -o CMakeFiles/cmTC_b9db5.dir/testCCompiler.c.o   -c sample/build/CMakeFiles/CMakeTmp/testCCompiler.c
    Linking C executable cmTC_b9db5
    /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b9db5.dir/link.txt --verbose=1
    /usr/bin/x86_64-w64-mingw32-gcc      -rdynamic CMakeFiles/cmTC_b9db5.dir/testCCompiler.c.o  -o cmTC_b9db5 
    x86_64-w64-mingw32-gcc: error: unrecognized command line option ‘-rdynamic’
    CMakeFiles/cmTC_b9db5.dir/build.make:106: recipe for target 'cmTC_b9db5' failed
    make[1]: *** [cmTC_b9db5] Error 1
    make[1]: Leaving directory 'sample/build/CMakeFiles/CMakeTmp'
    Makefile:141: recipe for target 'cmTC_b9db5/fast' failed
    make: *** [cmTC_b9db5/fast] Error 2

解法:

SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")