Zlib.h and zconf.h bug

Every time I try the following:

#include <zlib.h>

I get the following error message:

Limitation: can not handle macro ZEXTERN extern Use +P or -p option FILE:/home/gamma/root/include/zconf.h LINE:239

I have tried more than one version of root including the latest version.


If you are trying for the command prompt … just don’t (it would not give you access to the function its defines anyway … unless I am mistaken on the ‘zlib.h’ you are refering to.
If you are trying from rootcint, modify your command from

[quote]rootcint -f mydict.cxx -c myfile.h mylinkdef.h[/quote]to


I may be in the wrong forum. I was trying to include zlib.h from root, not rootcint. I have had no problems including other files such as iostream.h and iomanip.h. The error is occurring at the following lines:

#ifndef ZEXTERN

define ZEXTERN extern


This is from the zconf.h file that was included with root.


ROOT currently does not provide access from the prompt to the compiled method declared in zlib.h.

What is your purpose in trying to include zconf.h or zlib.h (if I understand what you are ultimately trying to do, I might be able to be more specific and helpfull in my comments :slight_smile: ).

If you need to process an include file that include them you may have to code guard them:

#ifndef __CINT__ #include <zlib.h> #endif

If you need to access the function defined in them, you need load them via ACLiC (so that it generates the appropriate dictionary:



I can introduce a feature that takes care of define macro like this.

#define ZEXTERN extern

For the time being, you can not erase it once you’ve load it. This should be fine for makecint/rootcint.

Thank you
Masa Goto

I have a code from someone else called dump_data.cc that converts the raw data into ascii. The problem is that the data files are over 100 MB each in ascii, so I am trying to histogram the data without making the ascii files.

Within the dump_data.cc file, there is a command,

gzread(in,&x,sizeof(unsigned long));

which reads in a block of data from the raw data file and stores the value in x. If I could find another function to replace gzread, then I would not have to include zlib.h.

Btw, I am using the commands,

.L dump_data.cc


The best for you (simpliest to use and actually fastest to run) is to rename your main function into something else (for example dump_data() ) and do

.L dump_data.cc+ main()
Note the additional charater ‘+’.


Thanks, the original code runs correctly now. I assume that the ‘+’ means that ROOT will compile the code first and make an executable with a ‘.so’ extension.

The only problem I have now is that ROOT functions, such as TH1F and TCanvas, are not recognized by the compiler. So, I get errors saying that they are undeclared functions.

I am going to need to histogram the results as the program loops through each data block to avoid the necessity of outputting to a file first.

Indeed (see User’s Guide for more information on ACLiC).

Add the proper #include statements. As you mentioned this is now compiled as typical C++.