std::vector needs to have dll-interface to be used by clients of class 'X warning

前端 未结 4 1276
长发绾君心
长发绾君心 2020-12-05 06:29

I\'m trying to make my library exportable as a DLL but I\'m getting a lot of these warnings for one specific class that uses std::vector:

template 

        
4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-05 06:58

    Exporting from a DLL is platform-specific. You will have to fix this for Windows (basically use declspec(dllexport/dllimport) on the instantiated class template) and encapsulate the required code in your Windows-specific preprocessor macro.

    My experience is that exporting STL classes from DLLs on Windows is fraught with pain, generally I try to design the interface such that this is not needed.

提交回复
热议问题