Skip to main content
gamedev.net
🔒 Locked

Compiling gzstream

Started by Anima 1 reply 1.9k views
Original Post
Anima
Anima
I've been trying to create a compressed file reader similar to gzstream (http://www.cs.unc.edu/Research/compgeom/gzstream/). The problem is that I've not had a chance to use it because I can't get it to compile. The errors aren't in the source code but in the STL headers, specifically cerrno.h, cstdlib.h, and cstdio.h. The first few errors which occur are:

c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\cerrno(16) : error C2143: syntax error : missing '{' before ':'
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\cerrno(16) : error C2059: syntax error : ':'
There are 204 errors, so I won't post them all! The above two errors appear in the following part of the cerrno.h header.

_STD_BEGIN
  #ifndef errno
using ::errno;   // <- Here
  #endif
_STD_END
I'm using MSVC++ 7.0, after just ditching 6.0 in hope of ridding myself of STL problems like this. Does anyone have a clue what the problem might be? The code isn't using any of the old '.h' headers (e.g. iostream.h), if this matters.
Fruny
Fruny
If you look carefully, you'll notice that the file is named 'gzstream.C', with an uppercase 'C'. To UNIX folks, this indicates that the source file is a C++ file. However, Windows filesystems are case insensitive, and VC is setup to consider .c files as C files.

It is then unsurprising the compiler would barf on C++ constructs.

So you need to tell it it is a C++ file, either by changing the extension to .cpp (or something else VC recognizes as a C++ file), or by forcing the issue (Properties->Advanced->Compile as C++).

The error I get then is about the missing zlib.h header, since I haven't installed it on this machine, but your current problem should be solved.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Anima
Anima
That simple, eh? I should've realised this because I've had a very similar problem before. Well, it works now anyway.

Thanks

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.