C++: warning: '…' declared with greater visibility than the type of its field '…::'

前端 未结 3 1946
礼貌的吻别
礼貌的吻别 2021-01-17 23:48

I\'m getting these two warnings (with GCC 4.2 on MacOSX):

/Users/az/Programmierung/openlierox/build/Xcode/../../src/main.cpp:154:0 /Users/az/Programmierung/openliero

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-18 00:23

    There seems to be a problem with shared libraries. I assume you are writing a shared library. Look at this explanation. Try to add the command line option -fvisibility-inlines-hidden. The problem seems to be, that gcc tries to export some symbols of MainLockDetector (visible to linking executables and libraries), whereas Action is not exported (invisible to linking executables and libraries). So the visibility of MainLockDetector really is higher than the visibility of Action.

提交回复
热议问题