1748022 Members
4832 Online
108757 Solutions
New Discussion юеВ

compilation error

 
YE LIU_1
Frequent Advisor

compilation error

Dear VMS Users,

I come across the following compilation when compiling string.cpp, which is enclosed. My guess is that I miss defining a macro so that I will not use multiple byte string. Could you give your opinion?

Thanks,

YE LIU

CXX /DEFINE=(USE_MULTINET,_DECC_V4_SOURCE,__DECC)/show=include/list /USING_STD /UNDEF=(_MBSTATE_T) string.cpp

typedef mbstate_t state_type;
............^
%CXX-E-UNDECLARED, identifier "mbstate_t" is undefined
at line number 192 in module RW_INTERNAL_TRAITS.H of text library SYS$COMMON:[SYSLIB]CXXL$ANSI_DEF.TLB;1

typedef mbstate_t state_type;
............^
%CXX-E-UNDECLARED, identifier "mbstate_t" is undefined
at line number 291 in module RW_INTERNAL_TRAITS.H of text library SYS$COMMON:[SYSLIB]CXXL$ANSI_DEF.TLB;1

typedef mbstate_t state_type;
............^
%CXX-E-UNDECLARED, identifier "mbstate_t" is undefined
at line number 387 in module RW_INTERNAL_TRAITS.H of text library SYS$COMMON:[SYSLIB]CXXL$ANSI_DEF.TLB;1

return wmemcmp (__s1, __s2, __n);
...............^
%CXX-E-UNDECLARED, identifier "wmemcmp" is undefined
at line number 409 in module RW_INTERNAL_TRAITS.H of text library SYS$COMMON:[SYSLIB]CXXL$ANSI_DEF.TLB;1

return _RWSTD_STATIC_CAST (const char_type*,
...............^
%CXX-E-UNDECLARED, identifier "wmemchr" is undefined
at line number 437 in module RW_INTERNAL_TRAITS.H of text library SYS$COMMON:[SYSLIB]CXXL$ANSI_DEF.TLB;1

wmemmove (__s1, __s2, __n);
........^
%CXX-E-UNDECLARED, identifier "wmemmove" is undefined
at line number 455 in module RW_INTERNAL_TRAITS.H of text library SYS$COMMON:[SYSLIB]CXXL$ANSI_DEF.TLB;1

wmemset (__s, __a, __n);
........^
%CXX-E-UNDECLARED, identifier "wmemset" is undefined
at line number 472 in module RW_INTERNAL_TRAITS.H of text library SYS$COMMON:[SYSLIB]CXXL$ANSI_DEF.TLB;1

11 REPLIES 11
Hoff
Honored Contributor

Re: compilation error

It appears the requisite inclusion of needed for the wmemset call and other functions was omitted from the compilation unit.
YE LIU_1
Frequent Advisor

Re: compilation error

Did you look at the source code before you replied?

YE LIU
Gregg Parmentier
Frequent Advisor

Re: compilation error


you're including cwchar, not cwchar.h

does that matter?

does the order you reference matter?
YE LIU_1
Frequent Advisor

Re: compilation error

That is what I want to find out. BTW, I include wchar.h and it still does not work.

YE LIU
Hoff
Honored Contributor

Re: compilation error

As it turns out, I did compile the wrong file; and I had another random CXX laying around that built cleanly. Time to clean up the ITRC scratch area, apparently.

But having sorted that boo-boo out, the code gets the following build error:

$ cxx x

#include "SocketMisc.h"
.......................^
%CXX-E-SRCFILNOOPEN, could not open source file "SocketMisc.h"
at line number 39 in file ...X.CXX;20

That header file was missing from the test build, and the test box doesn't use Multinet. Either of these could send the compilation off the rails. (And I don't see the header file with the inclusion.)

The code wasn't compiled with V4 (that's very old), and the compilation didn't disable the _MBSTATE_T, and didn't select Multinet as none of those appeared (directly) in the source code. No Multinet here, too. Interestingly, the code itself doesn't actually check the Multinet settings before it loads a pile of Multinet includes; it's surprised the compilation pass didn't flag those, too.

It wouldn't surprise me that the wchar stuff isn't compatible with the V4-vintage C code, either.

What compiler version, and what platform?

Got a more complete example or that header file?
YE LIU_1
Frequent Advisor

Re: compilation error

You can remove that line.

YE LIU
Hoff
Honored Contributor

Re: compilation error

There doesn't seem to be a reason for the Multinet stuff, so I removed it. After removing various header files and some pieces, the (unmodified) code builds cleanly.

Here's the prolog code...

#include
#include
#include
#include
#include
#include
#include
#include

#include

#ifndef _RWSTD_HEADER_REQUIRES_HPP
#include
#else
#include
#endif

#ifdef __USE_STD_IOSTREAM
#include
#else
#include
#endif
#include
#include
#include

#include

int main ()
{
{remainder of code unchanged}

YE LIU_1
Frequent Advisor

Re: compilation error

I used this command to compile:

CXX /DEFINE=(_DECC_V4_SOURCE,__DECC)/show=include/list /USING_STD string.cpp

when I removed _DECC_V4_SOURCE, it works.

YE LIU
Hoff
Honored Contributor

Re: compilation error

So this appears to involve what is effectively lying to the compiler -- this isn't really V4-vintage source code -- and that got caught out.

Or in your more succinct description, that "doesn't work".

Is there a particular reason for the (sorry!) somewhat scatter-shot source code here (is this a cut-down example from something larger?) or for (in general) the use of the V4 compiler knob here?