Skip to content


Zwetan Kjukov edited this page Jan 12, 2016 · 7 revisions

Dealing With Compilation Errors


Visual Studio

To target only Visual Studio compilation do this

#ifdef _MSC_VER
    //something concerning MSVC only

Disabling warnings

In general, all warnings are treated as errors, and in some special cases we need to disable just one or few lines generating a warning.

Disabling warnings for one line

#pragma warning(suppress:1234)
// single line of code where the warning occurs

Disabling warnings for multiple lines

#pragma warning(push)
#pragma warning(disable:1234)
// some multiple lines
// where the warning occurs
#pragma warning(pop)

Disabling warnings for the whole file

/* header stuff
in general a license */

#include <one.h>
#include <two.h>

 * MSVC compile with the /W4 warning level which is
 * quite picky. Disable warnings we don't care about.
#ifdef _MSC_VER
    #pragma warning(disable:1234) //reason of the warning
    #pragma warning(disable:1235) //reason of the warning
    #pragma warning(disable:1236) //reason of the warning

class SomeThing : public OtherThing
You can’t perform that action at this time.