GLOW API version 1.0 reference

Back to
Table of contents


Compiler compatibility

Introduction

The GLOW Toolkit requires a C++ compiler that is ANSI/ISO compliant, or nearly so. I have successfully built GLOW programs using gcc 2.95 under Linux, MIPSPro 7.3 under IRIX, Metrowerks Codewarrior under MacOS and Windows, and MSVC++ 6.0 under Windows. Information on building GLOW programs using these tools follows on this page. Other compilers and development systems may also be able to build GLOW programs, but you may need to set certain flags depending on the level of ANSI compatibility. For more information, see the page on preprocessor symbols.

gcc 2.95

Recent versions of gcc are getting close to being ANSI C++ compliant. The primary issues as of version 2.95 are the state of the iostreams library; however, GLOW doesn't need to make extensive use of iostreams, so gcc shouldn't have much trouble compiling GLOW.

MIPSPro 7.3

The MIPSPro 7.3 C++ compiler for IRIX is able to compile GLOW with a small amount of effort. The main issue is compatibility with namespace std and the new header naming scheme. In particular the new-style C header names are not provided in the development system. To work around this, wrapper headers are present in the source distribution of GLOW in the folder "Compat-SGI". You should install these headers or otherwise include the folder in an -I directive to the compiler.

If you are using a version of MIPSPro newer than 7.3.0, check your /usr/include/CC directory (and it would probably be a good idea to check /usr/include also) to make sure headers with these names have not been added by SGI. If the files are already present, you should not use the ones in "Compat-SGI".

To compile GLOW, you also need to pass the following flags to CC:

-LANG:std

This is necessary to activate certain features of ANSI C++. GLOW will not compile successfully unless this option is specified.

-no_auto_include

This is not strictly necessary for successful compilation, but you should use it to prevent linker warnings about duplicate definitions of Sender_Base and Receiver_Base. The flag prevents the compiler from attempting to automatically include glowSenderReceiver.cpp whenever glowSenderReceiver.h is included. (MIPSPro appears to do this as a hack to simulate the effect of the unimplemented C++ export keyword. I find it a distasteful hack and a nuisance.)

-woff 1209,1424,3201

I recommend turning off these warnings because they're a nuisance. 3201 flags unused parameters, which are common in C++ code, particularly in virtual methods. 1424 flags templates parameters that are not used in declaring the argument types of a function template, which seems to happen often in the standard libraries. 1209 flags "while(true)" and "if(true)" which are used occasionally in GLOW's code and in debugging code.

-DGLOW_COMPAT_CLIBNOSTDNAMESPACE

This is necessary for succesful compilation. It causes GLOW to work around the fact that MIPSPro does not put the standard C library into namespace std.

Versions of the MIPSPro C++ compiler prior to 7.3 probably cannot compile GLOW. Later versions may require fewer hacks.

Metrowerks Codewarrior Pro 5

Codewarrior Pro 5 is very close to being ANSI C++ compliant and should not require any hacks. The primary issue you'll face is creating a project file. My suggestion for doing this is to start with one of the GLUT example programs, and modify its project file. This will give you the right libraries to use. Then, make sure all the ANSI C++ features (such as RTTI, bool, and so forth) are turned on in the C++ language panel. Finally, you'll need to remember to add the appropriate GLOW modules to your program when you build it. For the tutorials, you can determine which modules a program needs by looking at the provided Makefile. You can't use the Makefile directly with Codewarrior (its Makefile importer doesn't support some of the gnu-make features) but you can determine which GLOW modules need to be added to your project by looking at the definition of the variable "GLOWMODULES".

Microsoft Visual C++ 6.0

Visual C++ has a few ANSI issues, but as of GLOW 0.9.6, I've been able to work around pretty much all of them. Your first task is to get a project made up. The Windows Console Application stationery seems to work reasonable well for this. Next, make sure you have the GLUT dll properly installed (or a static library added to your project). Finally, you'll need to add the appropriate GLOW sources to the project. For the tutorials, you can determine which modules a program needs by looking at the provided Makefile. The Makefile is for gnu-make on a unix machine, and so you won't be able to use it with Windows, but you can determine which GLOW modules need to be added to your project by looking at the definition of the variable "GLOWMODULES".

There are several compiler settings that you'll need to modify in order to get GLOW to compile. First, you need to activate the /GR setting. This is necessary to activate RTTI, which is used by several parts of GLOW. Second, you need to make sure several symbols are defined. These should be added to the "preprocessor definitions" field of the C/C++ settings (go to "settings" under the "project" menu). The symbols to define are:

GLOW_COMPAT_NOTEMPLATESPECIALIZATIONS

MSVC++ doesn't seem to completely understand template specializations, so define this symbol to work around a template specialization defined in glowSenderReceiver.

GLOW_COMPAT_CLIBNOSTDNAMESPACE

This works around the fact that MSVC++ doesn't put the C standard library into namespace std.

GLOW_COMPAT_BADFORSCOPING

This works around the fact that MSVC++ incorrectly scopes variables declared in the parens of a for loop.

GLOW_COMPAT_NOSTDMINMAX

This works around the fact that the C++ standard libraries that come with MSVC++ don't include the min() and max() template functions.

NOMINMAX

This directs the Windows standard header "windef.h" not to define min and max as macros. You may need to do this to allow the C++ standard library template functions min() and max() to function properly if Windows headers are being #included.

Finally, if you're compiling in debug mode, you may want to change the debug information settings to something like "line numbers only". Otherwise, because GLOW uses STL pretty heavily, you may get several hundred warnings that such-and-such a symbol name is longer than 255 characters. You should also expect four warnings to be thrown out of glowViewTransform.inl.h concerning passing the "this" pointer into a member constructor. Those four warnings should be harmless in this case.


Back to
Table of contents


Daniel Azuma (dazuma@kagi.com)
Last updated 22 June 2000