C++ compilation errors: redefined , NULL used in arithemetic, undefined reference to,

hello , Bit of background before I mention errors :I am in process of migrating C/C++ project from Solaris 32bit to Red Hat Linux 64 bit.The old build process which was compiling C/C++ code is failing in new environment(i.e. RH linux 64bit).
I am using GNU makefile on linux env & some 2003 version makefile on Solaris.
In solaris env the code was passing compiler command line options. -mt and -features=no%conststrings
on Linux I replaced the -mt option with -pthread and removed the other option(features=no%conststrings),so compilation command changed to: CC -O -pthread
On Linux the make file was calling some internal commands to compile code & it switched to g++ instead of CC and started complaining about missing header files to resolve this I had to add "CXX = CC" and "CXXFLAGS=-I. -I$(include_files)" in the macro file.

Below are Errors and Warnings: I have numbered them below 1 to 3. i am getting many similar warnings and error I did not mention duplicates.

1) /src/grid/include/DataGrid.h: In member function ‘int DataRowList::moveGroups(int, int, char**)’:
/src/grid/include/DataGrid.h:3978: warning: NULL used in arithmetic
2)Warning: size of symbol `DataRow::addDLY_ProdTotRev()' changed from 10 in /tmp/ccm0J4Fx.o to 2 in /src/grid/obj/Datagrid.o
3)/src/grid/obj/Datagrid.o: In function `DataGrid::listBinarySearch_va(textConv*, char*, int, __va_list_tag*)':
Datagrid.cc:(.text+0x239c): undefined reference to `textConv::strcmp_ebcidic(char*, char*)'
Datagrid.cc:(.text+0x2449): undefined reference to `cgiDbg
src/grid/obj/Datagrid.o:Datagrid.cc:(.text+0x2dce): more undefined references to `cgiDbg' follow
collect2: ld returned 1 exit status
ia64make[4]: *** [Datagrid] Error 1

For error# 3 above the "cgiDbg" is defined as "extern FILE *cgiDbg;" inside "cgic.h" file and in cgic.C file it is probably getting initialized something like below.
int cgiInit(char *postoutputfile, char *outputfile, char *debugfile)
FILE *fp;
cgiIn = stdin;
cgiDbgPostOut = NULL;
if (strlen(postoutputfile))
fp = fopen(postoutputfile, "w+");
if (fp != NULL)
cgiDbgPostOut = fp;
} /* if successful open of post output file */
} /* if post output Filename specified */
cgiOut = stdout;
if (strlen(outputfile))
fp = fopen(outputfile, "w+");
if (fp != NULL)
cgiOut = fp;
} /* if successful open of output file */
} /* if output Filename specified */
cgiDbg = NULL;
if (strlen(debugfile))
fp = fopen(debugfile, "w+");
fp = fopen("/dev/null", "w+");
if (fp != NULL)
cgiDbg = fp;
} /* if successful open of debug file */
return (p_cgiInit());
The above mentioned cgic.h header file is included in one other header file textConv.h which is included in DataGrid.h , that is where I am getting this error message.

Many thanks for your help in advace..
Last edited on
Resolved the warning#1 . old code was doing something like below in conditional statement so was getting warning: NULL used in arithmetic

"NULL == somefuntion()"

Changed it to

"0 == somefunction()"

code compiled fine after this change.
Was able to fix warning #3
)/src/grid/obj/Datagrid.o: In function `DataGrid::listBinarySearch_va(textConv*, char*, int, __va_list_tag*)':
Datagrid.cc:(.text+0x239c): undefined reference to `textConv::strcmp_ebcidic(char*, char*)'

by adding "inline" before function name in .cc file.
Topic archived. No new replies allowed.