Thread View: comp.lang.c++.leda
1 messages
1 total messages
Started by Michael Hamman
Sun, 13 Aug 1995 02:38
MSVC++1.51 #defines???
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads