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

前端 未结 4 1292
长发绾君心
长发绾君心 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:40

    You could just export the members, which the dll-clients need to access. To do this remove the export declaration from the class declaration and add it to each individual member function you want to export.

    EDIT:

    In your case you should probably not try to export the class (leave out AGUI_CORE_DECLSPEC) since it is a template class. Provide all methods in your header as inline and it will work.

    If you do not want this, some compilers provide a special way to export template classes. But you will have to specify the template parameter for this.

提交回复
热议问题