Discussion:
Unexplainable compilation error using CCS 3.2 on UnixWare 7.1.1
(too old to reply)
clement tang
2003-12-03 22:14:51 UTC
Permalink
We have an unexplainable compilation error that affects several source
files. This product has been ported to other Unix platforms without
any problem. This is our development environment on UnixWare 7.1.1.

Our system has:
UnixWare vbroker1 5 7.1.1 i386 x86at SCO UNIX_SVR5

Optimizing C Compilation System (CCS) 3.2
UX:CC: INFO: C++ Compilation System 3.1 09/28/99
(santamariasbl5.1.rs1ubl7)

%ld -V
UX:ld: INFO: Optimizing C Compilation System (CCS) 3.2 08/02/01
(uw711_vcutbl5.1)

gmake -v
GNU Make version 3.76.1, by Richard Stallman and Roland McGrath.


The problem in general is that the compiler confuses the function name
with leading "_" char like "_shutdown()" to "shutdown()".
Here is an example :-

Header file (child.h):

class child : public generatedCPP
{
protected:
void _shutdown(); // internal use

public:
void shutdown();
void shutdown(const char* msg, int abc);
}

Implemenation file (child.C):

void child::_shutdown() {
// some code;
}
void child::shutdown() {
// some code
_shutdown();
}
void child::shutdown(char* msg, int abc) {
// some code
_shutdown();
}

The compilation error is:
:child.h, line xxx: error: function "child::_shutdown()" has already
been declared :child.C, line xxx: error: function "child::_shutdown()"
has already been defined

If I rename the protected function _shutdown() to _my_shutdown(),
child.C will compile but the caller class will have this compilation
error:
"caller.C", line 2193: error: class "child" has no member "_shutdown"

class caller {
//other code;
void caller::test() {
// other code
child::shutdown(); <= compilation fail here.
}
}

It seems like the compiler sees child::shutdown() function call in
caller.C and expects to find _shutdown() in child.h. The only way to
work around is to change the public function name shutdown() to
my_shutdown() so that the protected _shutdown() has a different name
with public shutdown() function like this:

clase child:public generatedCPP
{
protected:
void _shutdown();
public:
void my_shutdown();
void shutdown(char* msg, int abc);
}

After numerious trials to rename and change position of function
declaration in the header file, we belive that the compiler is
confused with the function name _ABC with generated symbol _ABC since
we have other files with similar problem for _send() and send().

Also the compiler will complain with same error even the source code
only has ONE shutdown() declaration in header and implementation in .C
file in the same directory. The compiler will still look for
_shutdown and return an error. "abc.C", line 552: error: class
"myFile" has no member "_shutdown"

In addition, if we rename the shutdown() then it will complain the
virtual function of shutdown in parent class is not overloaded. pure
virtual function "ProtocolEngine::EngineManager::shutdown" has no
overrider
_protocol_manager = new VISProtocolManager;

The unfortunate things is that the compilation error only happens to
our source code. I have a very simple header file (test.h) and source
file (test.C) like the example above. The sample files compile ok?!
The sample test files are located in the same directory and defined in
the Makefile using same gmake and CC compiler (with same switch
settings).

Could this possibly a bug in the compiler? Can someone point me to
the right direction?

Many thanks!
Robert Lipe
2003-12-03 22:43:28 UTC
Permalink
Post by clement tang
We have an unexplainable compilation error that affects several source
This isn't so unexplainable. When you asked this same question
yesterday, you got two perfectly lovely (and incredibly similar)
explanations that optimized down to "quit using reserved identifiers"
Loading...