IBM Support

PCHAR * is undefined when compiling a component

Troubleshooting


Problem

When compiling a Windows component an error occurs similar to below. > Compiling Element Element.cpp C:\Program Files\Microsoft Visual Studio\VC98\Include\winnt.h(161) : error C2143: syntax error : missing ';' before '*' C:\Program Files\Microsoft Visual Studio\VC98\Include\winnt.h(161) : error C2501: 'PCHAR' : missing storage-class or type specifiers

Cause

Looking at winnt.h (excerpt below) if VOID is not defined then the "typedef char CHAR;" is processed. If VOID is defined in your model or externally referenced source files, then CHAR will be undefined and an error will result.

//
// Basics
//

#ifndef VOID
#define VOID void
typedef char CHAR;
typedef short SHORT;
typedef long LONG;
#endif
...

//
// ANSI (Multi-byte Character) types
//
typedef CHAR *PCHAR;
typedef CHAR *LPCH, *PCH;
...

Resolving The Problem

Users should always be cautious when defining things in their models. They should verify they are not overriding some define that exists for the Target Operating System or the Rose RealTime TargetRTS libraries.

To correct the error above, make sure VOID is not defined in your model. Then CHAR will be defined in winnt.h and the compilation error will not occur.







[{"Product":{"code":"SSSHKL","label":"Rational Rose RealTime"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Not Applicable","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2002;2003","Edition":"All Editions","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
16 June 2018

UID

swg21197591