ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

strcmp function

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
485 Views, 4 Replies

strcmp function

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
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

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



"Hung Nguyen" wrote in message
news:3F1C56A7.FDF721DD@ndsu.nodak.edu...
> 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
>
Message 3 of 5
Anonymous
in reply to: Anonymous

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:3F1C56A7.FDF721DD@ndsu.nodak.edu...
> 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
>
Message 4 of 5
Anonymous
in reply to: Anonymous

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

Joseph

"Hung Nguyen" wrote in message
news:3F1C56A7.FDF721DD@ndsu.nodak.edu...
> 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
>
Message 5 of 5
Anonymous
in reply to: Anonymous

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost