Binh Nguyen
Binh Nguyen

Reputation: 71

Android native "undeclared (first use in this function)"

I am quite new to the android-ndk. For this code

const char *inCStr = (*env)->GetStringUTFChars(env, str, NULL);
if (inCSt && inCSt[0] != '\0') {
    char *outCStr = b64encode(inCStr);
    return (*env)->NewStringUTF(env, outCStr);
}

I get the error

'inCSt' undeclared (first use in this function)
if (inCSt && inCSt[0] != '\0') {

What did I do wrong?

Upvotes: 2

Views: 516

Answers (1)

Chris Stratton
Chris Stratton

Reputation: 40407

const char *inCStr = (*env)->GetStringUTFChars(env, str, NULL);
if (inCSt && inCSt[0] != '\0') {

You declared inCStr but tried to use inCSt without the r

Upvotes: 1

Related Questions