My header file contains, among other things:
#define PAUSE system("pause");
typedef unsigned char uint8;
static const double PI = 3.14159265358979323846;
static const double oneDegInRads = PI / 180;
I've been including this header file into many .cpp files all over the place without a single problem. As I want to clean up my code I was fixing warnings, mostly minor stuff like "cast double to float, possible loss of data", or "unsigned to signed mismatch" warnings. So I turned on the "Treat compiler warnings as errors" in the settings, so by using that I can have a strict assessment of how bad my code is and fix it accordingly. With it turned on, my solution won't build, and shows the error:
Code Description File
C2220 "Warning treated as error - no 'object' file generated myDefinitions.h
I know why this is happening, as I turned that specific setting on. I have tried suppressing and disabling this warning with:
#pragma warning (disable : 2220)
And I've tried also following the "One CPP for each header rule", making a "myDefinitions.cpp" and including only the header and nothing else, but the error message still comes up.
So my questions are:
1: Can I have a header file without a .cpp one (without ignoring the warnings)?
2: If not, how do I make my .cpp, as I've already tried but failed?
3: What better solution can you suggest to have one page where all your important definitions that you use very frequently are? I need to make it possible to include them anywhere you want.