因此,4251警告至少是微软编译器的一个严重基础。基本上,只要您在标题定义中使用模板类或非dllexport类,就会收到此警告。更好的是,在stl中有许多类(如map),您甚至无法消除此错误。
我的问题是,对于特定的类,"#pragma warning(disable: 4251)"根本不起作用。它在其他地方都起作用,但在这里不起作用。
DelWestInspectionProgram.cpp
#include "stdafx.h"
#pragma warning(disable: 4251)
...
Output Log:
E:\svn\VisionNow\VisionSuite\VI.Inspector.ImageProcessing.Common\BIImage.h(79): warning C4251: 'BIImage::_data' : class 'boost::shared_array<T>' needs to have dll-interface to be used by clients of class 'BIImage'
6> with
6> [
6> T=unsigned char
6> ]
6>E:\svn\VisionNow\VisionSuite\VI.Inspector.ImageProcessing.Operators\BIImageOperator.h(25): warning C4251: 'BIImageOperator::_savePath' : class 'std::basic_string<_Elem,_Traits,_Ax>' needs to have dll-interface to be used by clients of class 'BIImageOperator'
6> with
6> [
6> _Elem=char,
6> _Traits=std::char_traits<char>,
6> _Ax=std::allocator<char>
6> ]
任何帮助都将不胜感激。