strcmp function

strcmp function

Anonymous
Not applicable
1,000 Views
4 Replies
Message 1 of 5

strcmp function

Anonymous
Not applicable
Hi everyone,

I have been trying to compile a sample project in ObjectARX SDK (named
brsamplevc4x.dsw) and kept receiving an error: 'strcmp' : undeclared
identifier.
Could anybody tell me what was wrong with the strcmp function in the
following codes:

AcDb::SubentType subType;
char opt[128];

while (Adesk::kTrue) {
ads_printf("+AFw-nEnter Subent Type: ");
ads_initget(NULL, "Edge Face Brep");
if ((adsError = ads_getkword("Edge/Face/: ", opt))
== RTCAN) return adsError;

// Map the user input to a valid subentity type
if (strcmp(opt,"Brep") || strcmp(opt,"")) {
subType = kNullSubentType;
break;
} else if (strcmp(opt, "Face") == 0) {
subType = kFaceSubentType;
break;
} else if (strcmp(opt, "Edge") == 0) {
subType = kEdgeSubentType;
break;
}
}

Thanks,

Herbert Nguyen
0 Likes
1,001 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Should you be using: AcDb:: namespaces in front of your types, i.e.:
AcDb::kNullSubentType ?



"Hung Nguyen" wrote in message
news:[email protected]...
> Hi everyone,
>
> I have been trying to compile a sample project in ObjectARX SDK (named
> brsamplevc4x.dsw) and kept receiving an error: 'strcmp' : undeclared
> identifier.
> Could anybody tell me what was wrong with the strcmp function in the
> following codes:
>
> AcDb::SubentType subType;
> char opt[128];
>
> while (Adesk::kTrue) {
> ads_printf("+AFw-nEnter Subent Type: ");
> ads_initget(NULL, "Edge Face Brep");
> if ((adsError = ads_getkword("Edge/Face/: ", opt))
> == RTCAN) return adsError;
>
> // Map the user input to a valid subentity type
> if (strcmp(opt,"Brep") || strcmp(opt,"")) {
> subType = kNullSubentType;
> break;
> } else if (strcmp(opt, "Face") == 0) {
> subType = kFaceSubentType;
> break;
> } else if (strcmp(opt, "Edge") == 0) {
> subType = kEdgeSubentType;
> break;
> }
> }
>
> Thanks,
>
> Herbert Nguyen
>
0 Likes
Message 3 of 5

Anonymous
Not applicable
You need to make sure that string.h is #included so that the strcmp function
is declared before being used.

"Hung Nguyen" wrote in message
news:[email protected]...
> Hi everyone,
>
> I have been trying to compile a sample project in ObjectARX SDK (named
> brsamplevc4x.dsw) and kept receiving an error: 'strcmp' : undeclared
> identifier.
> Could anybody tell me what was wrong with the strcmp function in the
> following codes:
>
> AcDb::SubentType subType;
> char opt[128];
>
> while (Adesk::kTrue) {
> ads_printf("+AFw-nEnter Subent Type: ");
> ads_initget(NULL, "Edge Face Brep");
> if ((adsError = ads_getkword("Edge/Face/: ", opt))
> == RTCAN) return adsError;
>
> // Map the user input to a valid subentity type
> if (strcmp(opt,"Brep") || strcmp(opt,"")) {
> subType = kNullSubentType;
> break;
> } else if (strcmp(opt, "Face") == 0) {
> subType = kFaceSubentType;
> break;
> } else if (strcmp(opt, "Edge") == 0) {
> subType = kEdgeSubentType;
> break;
> }
> }
>
> Thanks,
>
> Herbert Nguyen
>
0 Likes
Message 4 of 5

Anonymous
Not applicable
one silly question, did you include string.h? On which line compiler found
the error?

Joseph

"Hung Nguyen" wrote in message
news:[email protected]...
> Hi everyone,
>
> I have been trying to compile a sample project in ObjectARX SDK (named
> brsamplevc4x.dsw) and kept receiving an error: 'strcmp' : undeclared
> identifier.
> Could anybody tell me what was wrong with the strcmp function in the
> following codes:
>
> AcDb::SubentType subType;
> char opt[128];
>
> while (Adesk::kTrue) {
> ads_printf("+AFw-nEnter Subent Type: ");
> ads_initget(NULL, "Edge Face Brep");
> if ((adsError = ads_getkword("Edge/Face/: ", opt))
> == RTCAN) return adsError;
>
> // Map the user input to a valid subentity type
> if (strcmp(opt,"Brep") || strcmp(opt,"")) {
> subType = kNullSubentType;
> break;
> } else if (strcmp(opt, "Face") == 0) {
> subType = kFaceSubentType;
> break;
> } else if (strcmp(opt, "Edge") == 0) {
> subType = kEdgeSubentType;
> break;
> }
> }
>
> Thanks,
>
> Herbert Nguyen
>
0 Likes
Message 5 of 5

Anonymous
Not applicable
Thanks alot for your quick response.

H.N.


Hung Nguyen wrote:

> Hi everyone,
>
> I have been trying to compile a sample project in ObjectARX SDK (named
> brsamplevc4x.dsw) and kept receiving an error: 'strcmp' : undeclared
> identifier.
> Could anybody tell me what was wrong with the strcmp function in the
> following codes:
>
> AcDb::SubentType subType;
> char opt[128];
>
> while (Adesk::kTrue) {
> ads_printf("\nEnter Subent Type: ");
> ads_initget(NULL, "Edge Face Brep");
> if ((adsError = ads_getkword("Edge/Face/: ", opt))
> == RTCAN) return adsError;
>
> // Map the user input to a valid subentity type
> if (strcmp(opt,"Brep") || strcmp(opt,"")) {
> subType = kNullSubentType;
> break;
> } else if (strcmp(opt, "Face") == 0) {
> subType = kFaceSubentType;
> break;
> } else if (strcmp(opt, "Edge") == 0) {
> subType = kEdgeSubentType;
> break;
> }
> }
>
> Thanks,
>
> Herbert Nguyen
0 Likes