FreeCAD/FreeCAD

Windows: MSVC Compiler Warning: `boost::signals2::scoped_connection` needs to have dll-interface to be used by clients of `Gui::DocumentObserver`

已關閉

#22,139 建立於 2025年6月23日

 (0 則留言) (0 個反應) (0 位負責人)C++ (5,550 個分叉)batch import
Good first issueOS: WindowsPackaging/buildingType: Feature

倉庫指標

星標
 (30,913 顆星)
PR 合併指標
 (平均合併 24天 7小時) (30 天內合併 217 個 PR)

描述

Is there an existing issue for this?

  • I have searched the existing issues

Problem description

The DocumentObserver class defined in src/Gui/DocumentObserver.h has ten private member variables that are of type boost::signals2::scoped_connection. Boost deliberately does not export these symbols with a DLL interface, and so MSVC warns about them, e.g.

G:\FreeCAD\FreeCAD\src\Gui/DocumentObserver.h(368): warning C4251: 'Gui::DocumentObserver::connectDocumentDelete': 'boost::signals2::scoped_connection' needs to have dll-interface to be used by clients of 'Gui::DocumentObserver'
G:\FreeCAD\FreeCAD-LibPack-chennes\working\LibPack-1.1.0-v3.1.1.3-Release\include\boost-1_87\boost/signals2/connection.hpp(314): note: see declaration of 'boost::signals2::scoped_connection'

Because of the way we compile FreeCAD this does not represent a real problem, since all FC DLLs are compiled at the same time, by the same compiler, etc. so there can't be a binary incompatibility. However, the compiler warning is annoying. We probably shouldn't completely disable it, since sometimes it does indicate a real problem. One solution would be to move all of those connection variables into a private implementation class defined in the *.cpp file.

Full version info

https://github.com/FreeCAD/FreeCAD/commit/71eed18cb161bdb23341bfe7f907fa7c4bd21230

Subproject(s) affected?

None

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

貢獻者指南