Article View: comp.lang.c++.leda
Article #35MSVC++1.51 #defines???
From: Michael Hamman
Date: Sun, 13 Aug 1995 02:38
Date: Sun, 13 Aug 1995 02:38
75 lines
2421 bytes
2421 bytes
I've just switched to MSVC++ 1.51 from Borland 4.5.
Does anyone know why the #defines in the following code generate
a compiler error???!!!
/////////////////////////////////////////////////////////////////
#ifndef DISPLAY_DEFINED
#define DISPLAY_DEFINED
#include <stdlib.h>
#include <iostream.h>
class Display
{
public:
virtual void ShowLine( int ) = 0;
virtual void ShowLine( unsigned int ) = 0;
virtual void ShowLine( unsigned long ) = 0;
virtual void ShowLine( long ) = 0;
virtual void ShowLine( char ) = 0;
virtual void ShowLine( char * ) = 0;
};
class DosDisplay : public Display
{
public:
void ShowLine( int i) { cout << i; }
void ShowLine( unsigned int i) { cout << i << endl; }
void ShowLine( unsigned long l) { cout << l << endl; }
void ShowLine( long l) { cout << l << endl; }
void ShowLine( char c) { cout << c << endl; }
void ShowLine( char * s) { cout << s << endl; }
};
#endif
////////////////////////////////////////////////////////////
When this is included in a .cpp file, and I try to compile that
file (or build a project with it) I get the following
compiler error message:
Error C1004: Unexpected end of file found
which is pointing at the #endif. This file (and the entire
build of which it is a part) compiles/links with no
problems under Borland 4.5.
I post this message, because I have run into this problem
frequently while developing MFC-based projects as well. I
have been using the
#ifndef SOMEHEADERFILENAME
#define SOMEHEADERFILENAME
class someClass {
// blah.
};
#endif
under Gnu C++ compilers as well as Borland without ever having
a problem. The situation becomes bizarre when I get the same
error with the preprocessor defs commented out!
I suspect there is some kind of M$ft voodoo afoot which I
must have missed somewhere along the line. Anyone know
anything about this?
Michael Hamman
m-hamman@uiuc.edu
Technical Details
Message-ID:
<40joju$3eg@vixen.cso.uiuc.edu>Path:
arc1-ca.pugleaf.net!uxh.cso.uiuc.edu!hammanShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!uxh.cso.uiuc.edu!hamman From: hamman@uxh.cso.uiuc.edu (Michael Hamman) Newsgroups: comp.lang.c++.leda Subject: MSVC++1.51 #defines??? Date: 13 Aug 1995 02:38:54 GMT Organization: University of Illinois at Urbana Message-ID: <40joju$3eg@vixen.cso.uiuc.edu> Reply-To: hamman@uxh.cso.uiuc.edu NNTP-Posting-Host: uxh.cso.uiuc.edu Summary: MSVC++ #defines?? Keywords: MSVC++, C++, pre-processor