C++ Cygwin上的声子抱怨Qt编译时不支持-fvisibility=hidden

C++ Cygwin上的声子抱怨Qt编译时不支持-fvisibility=hidden,c++,qt,cygwin,phonon,C++,Qt,Cygwin,Phonon,我试图在Cygwin的一个测试程序中使用声子库 CMake用于构建: 查找_包(需要声子) 但它会生成以下错误消息: $ make -- Found Qt-Version 4.8.5 (using /usr/bin/qmake-qt4) -- Found X11: /usr/lib/libX11.dll.a -- Found Automoc4: /usr/bin/automoc4.exe CMake Error at /usr/share/phonon/buildsystem/FindPhono

我试图在Cygwin的一个测试程序中使用声子库

CMake用于构建:

查找_包(需要声子)

但它会生成以下错误消息:

$ make
-- Found Qt-Version 4.8.5 (using /usr/bin/qmake-qt4)
-- Found X11: /usr/lib/libX11.dll.a
-- Found Automoc4: /usr/bin/automoc4.exe
CMake Error at /usr/share/phonon/buildsystem/FindPhononInternal.cmake:296 (message):
  Qt compiled without support for -fvisibility=hidden.  This will break
  plugins and linking of some applications.  Please fix your Qt installation.
Call Stack (most recent call first):
  /usr/lib/cmake/phonon/PhononConfig.cmake:30 (include)
  CMakeLists.txt:8 (find_package)
我的测试程序已经成功地使用了Qt,我用cygwin安装程序安装了Qt和Phonon

我试图编译Phonon的CMake脚本中使用的测试程序:

#include <QtCore/QtGlobal>
int main()
{
  #ifndef QT_VISIBILITY_AVAILABLE 
  #error QT_VISIBILITY_AVAILABLE is not available
  #endif 
}

那么这里出了什么问题?我认为,如果Cygwin的人提供了一个声子包,他们会确保它与他们的Qt包兼容。这个问题只发生在Cygwin上,我在Gentoo机器上试过,它编译起来没有问题。

在不支持ELF可见性属性的平台上,如Cygwin和Windows,KDE组件需要配置
-D_ukde_HAVE_GCC_visibility=NO
,以避免此错误。Cygwin phonon软件包(以及Cygwin Ports KDE软件包)是用cygport构建的,cygport会在中自动处理此问题。

OK,但我看不出这是如何回答我的问题的。我怎样才能让我的程序编译?声子也是KDE组件。非常感谢!我目前正在尝试使用Cygwin在Windows10上构建Amarok2.9,而你的回答正好做到了这一点@HyperQuantum:在配置构建时,您必须在最初的cmake调用中添加-D_ukde_have_GCC_VISIBILITY=NO。与此同时,我已切换到另一种方法。我现在用MinGW代替Cygwin,用Qt5代替Qt4,用QMultimedia代替Phonon。所以这个问题不再和我有关了。
main.cpp:24:3: error: #error QT_VISIBILITY_AVAILABLE is not available
  #error QT_VISIBILITY_AVAILABLE is not available
   ^