jonnyknowsbest
Technical User
I have a header file, and i am trying to get to grips with #ifndef, but i keep getting the following error message:
fatal error C1070: mismatched #if/#endif pair in file 'c:\program files\microsoft visual studio\vc98\include\conlib.h'
See code below:
/* Conlib.h */
/* NOTE: The original version included a #pragma once to check for redefinition, but i opted to change this to an #ifndef just to prove that i was paying attention to the tutorial */
/* Do a IFNDEF to make sure avoid redefinition */
#ifndef _CONLIB_H_
#define _CONLIB_H_
/* Windows standard header file */
#include <windows.h>
/* Conlib color codes */
enum ConColor
{
ConRed = 1,
ConGreen = 2,
ConBlue = 4
};
/* Conlib control class */
class ConLib
{
/* Screen and keyboard handles */
HANDLE m_Screen;
HANDLE m_Keyboard;
/* Color attributes */
WORD m_TextColor;
WORD m_BackgroundColor;
public:
/* Constructor / Destructor */
ConLib ();
~ConLib ();
/* Set attributes */
void SetBackgroundColor (WORD Color);
void SetTextColor (WORD Color);
void SetTitle (char * Title);
void SetPosition (COORD Position);
/* Output methods */
void Clear (void);
void OutputString (char * String);
/* Input methods */
void Read (char * Buffer, DWORD BufferSize);
int GetKey (void);
};
#endif
fatal error C1070: mismatched #if/#endif pair in file 'c:\program files\microsoft visual studio\vc98\include\conlib.h'
See code below:
/* Conlib.h */
/* NOTE: The original version included a #pragma once to check for redefinition, but i opted to change this to an #ifndef just to prove that i was paying attention to the tutorial */
/* Do a IFNDEF to make sure avoid redefinition */
#ifndef _CONLIB_H_
#define _CONLIB_H_
/* Windows standard header file */
#include <windows.h>
/* Conlib color codes */
enum ConColor
{
ConRed = 1,
ConGreen = 2,
ConBlue = 4
};
/* Conlib control class */
class ConLib
{
/* Screen and keyboard handles */
HANDLE m_Screen;
HANDLE m_Keyboard;
/* Color attributes */
WORD m_TextColor;
WORD m_BackgroundColor;
public:
/* Constructor / Destructor */
ConLib ();
~ConLib ();
/* Set attributes */
void SetBackgroundColor (WORD Color);
void SetTextColor (WORD Color);
void SetTitle (char * Title);
void SetPosition (COORD Position);
/* Output methods */
void Clear (void);
void OutputString (char * String);
/* Input methods */
void Read (char * Buffer, DWORD BufferSize);
int GetKey (void);
};
#endif