0

I added the following type to a header file

boost::function<void()> voidFunction;

and I get the following error

Error   291 error C2220: warning treated as error - no 'object' file generated  
Warning 2   warning C4251: ....: class 'boost::function<Signature>' needs to have dll-interface to be used by clients of class ...

My question is if there is a way to disable the warning for this type only programatically without making changes to the project configuration. I am using visual studio 2006.Currently I have the option enabled for "treat warning as errors". I wanted to know if I can keep that setting there and add something programatically in code to ignore the warning introduced by adding the statement.

boost::function<void()> voidFunction;
Rajeshwar
  • 11,179
  • 26
  • 86
  • 158
  • One example is in my answer here: http://stackoverflow.com/questions/33618480/vs2012-unsigned-negate – JSF Dec 09 '15 at 21:13
  • 3
    But more exactly your question http://stackoverflow.com/questions/7159348/disable-single-warning-error – JSF Dec 09 '15 at 21:14

0 Answers0