c++ - Where to put #prama warning preprocessor directive to suppress warnings? -


i have many header files , source codes project in c++. wanted suppress warnings, therefore, came know #pragma warning preprocessor. able suppress 1 kind of warning, namely 4251, putting #pragma warning(push) #pragma warning(disable:4251) ...some declarations/prototypes #pragma warning(pop)

in header file (utils.h) of corresponding source file(utils.cpp), warning have been shown.

now, there kind of warning (4146), occurring in source file, clah.cpp. putting same code, mentioned, header file of file (clahe.h). however, compiler not able suppress warning ? can please tell me if doing somewhere mistake ? or, putting pragma statements wrongly ? thanks.

p.s., beginner in c++.

if have header has

#pragma warning(push)  

on top ,

#pragma warning(pop)  

at bottom, after header parsed, warning settings reset. you'll need put pragma in cpp file well.

#include "someheader.h"  //this implementation file //some code 

translates, basically, to:

//contents of header file #pragma warning(push)  #pragma warning(disable:4251)  //warning disabled here  #pragma warning(pop)  //popped - initial state (warning enabled)  //this implementation file //some code 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -