www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/04/19:32:08

From: "Joost F. Jacob" <jacobjf AT cistron DOT nl>
Newsgroups: comp.os.msdos.djgpp
Subject: djpgg up to date ?
Date: 4 Sep 1998 23:29:15 GMT
Organization: Joost F. Jacob Software
Lines: 63
Message-ID: <01bdd85b$d811a320$6f00d83e@jacobjf>
NNTP-Posting-Host: cs6p46.dial.cistron.nl
NNTP-Posting-Date: 4 Sep 1998 23:29:15 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

To my disappointment the DJGPP C++ compiler (2.8.1) 
does not compile the programs in
http://www.bruceeckel.com/ThinkingInCPP2e.html
that use the ../require.h header file.
I am using a DOS-box under Win95.
MSVC++5.0 (with P.J.Plauger patches) does compile it, but i hate the mess
that compiler produces (.pch, .idb, .pdb, .dsw, .ncb, .opt, .plg, .dsp
files ,
would you believe it :-)


example file iocopy.cpp :
------------------------------
//: C03:IOcopy.cpp
// fstreams for opening files.
// Copies itself to TMP.TXT
#include <fstream>
#include "../require.h"
using namespace std;

int main() {
  ifstream infile("IOcopy.cpp");
  assure(infile, "IOcopy.cpp");
  ofstream outfile("tmp.txt");
  assure(outfile, "tmp.txt");
  char ch;
  while(infile.get(ch))
    outfile.put(ch);
} ///:~
------------------------------

g++ error messages when trying to compile the example iocopy.cpp:
------------------------------
C:\Code\Eckel>g++ -o iocopy.exe iocopy.cpp
../require.h: In function `void require(bool, char * = "Requirement
failed")':
In file included from iocopy.cpp:5:
../require.h:12: parse error before `using'

...etc...(4 more parse errors, all before `using' in require.h)
------------------------------

from require.h :
------------------------------
 9:  inline void 
10:  require(bool requirement, 
11:    char* msg = "Requirement failed") {
12:    using namespace std;
13:    if (!requirement) {
14:      fprintf(stderr, "%s", msg);
15:      exit(1);
16:    }
17:  }
------------------------------

Will a future version of DJGPP g++ compile it, or am i doing something
wrong?

regards,
Joost
----------------------------------------------------------
"To a three-year-old with a hammer, everything looks like a nail."

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019