All your JNI calls are missing the first parameter which should be env, as you're in compiling C code.

If your code was in C++, you could make calls like env->NewStringUTF("xx"). But in C, JNIEnv* isn't an object, hence you have to pass it as first argument, like so: (*env)->NewStringUTF(env, "xx")

As for NULL being undefined, you can solve this by including the header that defines it: #include <stddef.h>

Answer from ph0b on Stack Overflow
🌐
TechOverflow
techoverflow.net › 2019 › 06 › 20 › how-to-fix-c-error-null-undeclared
How to fix C error 'NULL undeclared' | TechOverflow
April 1, 2026 - main.c: In function ‘main’: main.c:3:17: error: ‘NULL’ undeclared (first use in this function) void* ptr = NULL; ^~~~ main.c:3:17: note: each undeclared identifier is reported only once for each function it appears in
Discussions

Why am I getting undeclared (first use in this function)
because fName is not the same as fname. Case sensitive. More on reddit.com
🌐 r/learnprogramming
5
3
April 8, 2015
'NULL' undeclared...
Allegro.cc Forums » Programming Questions » 'NULL' undeclared... ... Site Index | Search | News | Forums | Wiki | Online Users | View Source Copyright ©1999-2025, by Matthew Leverton You are visitor #122,436,366 since January 1999. This page has been viewed 664 times since March 2002. More on allegro.cc
🌐 allegro.cc
'NULL' undeclared (first use in this function)
I try to get rid of 900 lines of code in a main.cpp file. For that I tried to set up some kind of project directory structure. The first attempt is in: But when creating xTaskCreatePinnedToCore() in this code I get an error: ‘NULL’ undeclared (first use in this function) #include #include ... More on community.platformio.org
🌐 community.platformio.org
0
0
May 13, 2021
&#39;NRF_SUCCESS&#39; undeclared (first use in this function); did you mean &#39;EXIT_SUCCESS&#39;?
Hello, I merged the two projects usbd_cdc_acm_pca10056 (A) and ble_app_hids_mouse_pca10056_s140 (B) by copying all additional contents from A's flash_placement More on devzone.nordicsemi.com
🌐 devzone.nordicsemi.com
1
0
October 25, 2020
🌐
Reddit
reddit.com › r/learnprogramming › why am i getting undeclared (first use in this function)
r/learnprogramming on Reddit: Why am I getting undeclared (first use in this function)
April 8, 2015 -
#include <stdio.h>
#include <stdlib.h>
#include <string.h>



struct info 
{
  char *firstName;
  char *lastName;
  int PUID;
  int age;
};

struct node
{
struct info student;
struct node *next;
};


struct node *root = NULL;
struct node *curr = NULL;

void create_list_node( char fName[30], char lName[30], int id, int ages);
int main()
{

return 0;
}

/*
void create_list_no_nodes()
{
root = (struct node*)malloc(sizeof(struct node));
root-> next = 0;
}

*/

void create_list_node( char fName[30], char lName[30], int id, int ages)
{
  free(root);
  root = (struct node *) malloc(sizeof(struct node));


  root->student.firstName = fname;
  root->student.lastName = lname;
  root->student.PUID = id;
  root->student.age = ages;
  root->next = NULL; 

here is the error:

Lab5_main.c: In function ‘create_list_node’:
Lab5_main.c:54:29: error: ‘fname’ undeclared (first use in this function)
   root->student.firstName = fname;
                         ^
Lab5_main.c:54:29: note: each undeclared identifier is reported only once for each function it appears in
Lab5_main.c:55:28: error: ‘lname’ undeclared (first use in this function)
   root->student.lastName = lname;
                        ^
🌐
GeeksforGeeks
geeksforgeeks.org › c language › how-to-avoid-compile-error-while-defining-variables
How to avoid Compile Error while defining Variables - GeeksforGeeks
April 5, 2019 - Like C/C++, in Java, all identifiers are lexically (or statically) scoped, i.e.scope of a variable can be determined at compile time and independent of the function call stack. Example: ... prog.c: In function 'main': prog.c:5:18: error: 'x' undeclared (first use in this function) printf("%d", x); ^ prog.c:5:18: note: each undeclared identifier is reported only once for each function it appears in How to Correct the above code: Declare the variable x before using it in the outer scope.
🌐
Depot Games
allegro.cc › forums › thread › 332697
'NULL' undeclared...
Allegro.cc Forums » Programming Questions » 'NULL' undeclared... ... Site Index | Search | News | Forums | Wiki | Online Users | View Source Copyright ©1999-2025, by Matthew Leverton You are visitor #122,436,366 since January 1999. This page has been viewed 664 times since March 2002.
🌐
PlatformIO Community
community.platformio.org › t › null-undeclared-first-use-in-this-function › 21417
'NULL' undeclared (first use in this function) - PlatformIO Community
May 13, 2021 - I try to get rid of 900 lines of code in a main.cpp file. For that I tried to set up some kind of project directory structure. The first attempt is in: But when creating xTaskCreatePinnedToCore() in this code I get an error: ‘NULL’ undeclared (first use in this function) #include #include #include // #include void createAllTasks() { // All xTaskCreate… goes here and utilize the macros created // in taskConfig.h // Be...
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › q › 20031451
java - Undeclared variables error - Stack Overflow
And I suspect your message is "Uninitialized variable", pointing at the first if statement in processing. And that would be because the variable has no value assigned. But we don't know this because you didn't give us the message. ... import javax.swing.JOptionPane; public class Exer1Sano_an { public static void main(String[] args) { String L = null, W = null; String x = null; choice(x); measureW(W); measureL(L); processing(); System.exit(0); }// end of main meathod // for length and width public static String measureW(String W) { W = JOptionPane.showInputDialog("Enter the Width: "); return W; } public static String measureL(String L) { L = JOptionPane.showInputDialog("Enter the Length: "); return L; } // for chioce public static String choice(String x) { x = JOptionPane .showInputDialog("n\1.
🌐
EmbDev
embdev.net › arm programming with gcc/gnu tools
error: 'NULL' and 'stderr' undeclared - EmbDev.net
June 23, 2017 - EmbDev.net · Contact – Data privacy information – Advertising on EmbDev.net
🌐
H|ard|Forum
hardforum.com › bits & bytes › webmastering & programming
'NULL' undeclared? | [H]ard|Forum
April 10, 2006 - hey, I'm getting an error that says 'NULL' undeclared (first use this function) and thats my last error to fix and I was just wondering how to go about it, since I have no idea what is wrong. Thanks ... Whats Wrong? Its not defined. Without some more details like Language or a Code Example we might be able to help. ... right on! in java null is usually in lowercase if(Incinerator == null){ Incinerator= new Incinerator(); }
🌐
Reddit
reddit.com › r/askprogramming › c - error: ‘head’ undeclared (first use in this function)
r/AskProgramming on Reddit: C - error: ‘HEAD’ undeclared (first use in this function)
October 8, 2020 -

So i am creating a program that uses a linked list.

This code below compiles and works but i want to change it.

* Example of working code */
int main(){

    // Start menu
    menu();

    return 0;
  }

  void menu(){
      //Create list
      node * HEAD = NULL;
      HEAD = createLinkedList();

      //Print menu, scanf i
      int i = 13;
      while(i != 0){
      printMenu();
      scanf("%d", &val);
      if ( i == 1)
        printList(HEAD);


    }}

I want to rewrite the code so that the list is created in the "main" function, not the "menu" function. However when I tried to compile the code below i get the error: error: ‘HEAD’ undeclared (first use in this function)

* Example of not working code */
int main(){
    //Create list
    node * HEAD = NULL;
    HEAD = createLinkedList();

    // Start menu
    menu();

    return 0;
  }

  void menu(){


      //Print menu, scanf i
      int i = 13;
      while(i != 0){
      printMenu();
      scanf("%d", &val);
      if ( i == 1)
        printList(HEAD);    // ERROR here


    }}
🌐
Cprogramming
cboard.cprogramming.com › cplusplus-programming › 103806-null-undeclared-first-use-function.html
'NULL' undeclared (first use this function)
June 3, 2008 - I think you are misunderstanding the error message: First use in this function means that it is only recorded as undeclared ONCE, not every time it's being used (because it's usually only ONE mistake to not declare something - and the compiler telling you that 35 times because that's how many ...
🌐
Narkive
bug-gnulib.gnu.narkive.com › Y0SHyW6Y › select-c-496-error-null-undeclared
select.c:496: error: `NULL' undeclared - bug-gnulib@gnu.org
Permalink I got this error on a IRIX 6.5 system: checking for sys/select.h... yes checking whether <sys/select.h> is self-contained... no checking whether pselect is declared without a macro... no checking whether select is declared without a macro... no checking whether select supports a 0 argument... no ... CC select.lo select.c: In function `rpl_select': select.c:496: error: `NULL' undeclared (first use in this function) select.c:496: error: (Each undeclared identifier is reported only once select.c:496: error: for each function it appears in.) select.c:500: warning: implicit declaration of function `select' I pushed the patch below.
🌐
Medium
medium.com › @joeb3219 › uninitialized-behavior-in-java-and-thoughts-for-other-programming-languages-ec35bab21533
Uninitialized Behavior in Java (and Thoughts for Other Programming Languages) | by Joseph A. Boyle | Medium
May 20, 2018 - Quiz time: what happens when you declare a variable in Java, but don’t initialize it, and then go on to use the variable? Whether you guessed the variable will be initialized to zero or null, or that the compiler will throw an error, you’re only right sometimes.