linking ham ibrary when using QCC

Hi,

When compiling foo.c using ‘qcc’ and linking against the static libham
library, I get no errors and the executable is build without problems.

However when I use the ‘QCC’ compile command on a foo.cc file and link
against the static libham library, I get errors:

bash# QCC -o foo foo.cc -lham

In file included from foo.cc:7:
/usr/include/ha/ham.h:175: declaration of `operator ’ as non-function
/usr/include/ha/ham.h:175: confused by earlier errors, bailing out
cc: /usr/lib/gcc-lib/ntox86/2.95.3/cc1plus error 34

foo.c/foo.cc is a very simple file that looks like this:


#include <stdio.h>
#include <ha/ham.h>

int main(int argc, char* argv[])
{
return 0;
}

Don’t quite understand why? Am I missing something?

Thanks,
Eabrg

eabrg <eabrg21@yahoo.com> wrote:

Hi,

What version of QNX do you have installed?

When compiling foo.c using ‘qcc’ and linking against the static libham
library, I get no errors and the executable is build without problems.

However when I use the ‘QCC’ compile command on a foo.cc file and link
against the static libham library, I get errors:

bash# QCC -o foo foo.cc -lham

In file included from foo.cc:7:
/usr/include/ha/ham.h:175: declaration of `operator ’ as non-function
/usr/include/ha/ham.h:175: confused by earlier errors, bailing out
cc: /usr/lib/gcc-lib/ntox86/2.95.3/cc1plus error 34

Some of the earlier versions of ham were written by a C programmer,
and at least one function was prototyped:

int function( … int operator … )

which is fine in C. But, operator is a reserved word in C++, and this
is causing a problem for your C++ compile.

This is fixed in the 6.21B release of the ham.h header – as a workaround,
you might want to edit your ham.h header file and change the operator
parameter passed in on that line (175) and anywhere else it might occur
to something else (doesn’t much matter what, as long as it isn’t a
reserved word in C++ – operator_blah could work).

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.