exit status 1 - compiling error

I get an error message of the form "exit status 1 - compiling error for Arduino Mega 2560"

I don't know what I am missing, as far as I can tell I am not using any library function of a library that is not included. Pls have a look!

#define LED1 8
#define LED2 9

int* input;

void setup() {
  // put your setup code here, to run once:
  int Getinput();
  void LightLED(int* input);

 
  Getinput();
  LightLED(input);

}

void loop() {
  // put your main code here, to run repeatedly:

}

/***** function definitions *****/
  int Getinput(){
    if(Serial.available() >0){
      *input = atoi(Serial.read());
      while(true){
      switch(*input){
        case 0: return 0;break;
        case 1 ... 3: return 1;break;
        default: Serial.println("no valid input!");
                 *input = atoi(Serial.read());
                 continue;
      }
      }
    }
}

  void LightLed(int* input){
    switch(*input){
      case 0: digitalWrite(LED1,LOW);
              digitalWrite(LED2,LOW);
              delay(1000);
      case 1: digitalWrite(LED1,HIGH);
              delay(1000);
              digitalWrite(LED1,LOW);
      case 2: digitalWrite(LED2,HIGH);
              delay(1000);
              digitalWrite(LED2,LOW);
      case 3: digitalWrite(LED1,HIGH);
              digitalWrite(LED2,HIGH);
              delay(1000);
    }
  }

Where is the rest of the error message? Particularly the part just above the fairly useless bit you have quoted that gives details of the error(s) and what line(s) of code caused them? Use the "Copy Error Messages" button to get the full error details and post here, in code tags please.

Steve

*input = atoi(Serial.read());writing to memory you don't own isn't going to go well

here is the error message:

Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\User\Documents\Arduino\Pointer\Pointer.ino: In function 'int Getinput()':

C:\Users\User\Documents\Arduino\Pointer\Pointer.ino:31:33: warning: invalid conversion from 'int' to 'const char*' [-fpermissive]

*input = atoi(Serial.read());

^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:23:0,

from sketch\Pointer.ino.cpp:1:

c:\program files (x86)\arduino\hardware\tools\avr\avr\include\stdlib.h:276:12: note: initializing argument 1 of 'int atoi(const char*)'

extern int atoi(const char *__s) ATTR_PURE;

^

C:\Users\User\Documents\Arduino\Pointer\Pointer.ino:37:44: warning: invalid conversion from 'int' to 'const char*' [-fpermissive]

*input = atoi(Serial.read());

^

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:23:0,

from sketch\Pointer.ino.cpp:1:

c:\program files (x86)\arduino\hardware\tools\avr\avr\include\stdlib.h:276:12: note: initializing argument 1 of 'int atoi(const char*)'

extern int atoi(const char *__s) ATTR_PURE;

^

C:\Users\User\AppData\Local\Temp\ccXHfYG5.ltrans0.ltrans.o: In function `main':

ccXHfYG5.ltrans0.o:(.text.startup+0x192): undefined reference to `LightLED(int*)'

collect2.exe: error: ld returned 1 exit status

exit status 1
Fehler beim Kompilieren für das Board Arduino/Genuino Mega or Mega 2560.

Dieser Bericht wäre detaillierter, wenn die Option
"Ausführliche Ausgabe während der Kompilierung"
in Datei -> Voreinstellungen aktiviert wäre.

Try using auto format (ctrl-t) on your code.
Get back to us.

it didn't help.

But I think you're right, it has something to do with *int = atoi(Serial.read())

can you explain to me why this expression is harmful?

it didn't help

If you say so.

You have a pointer.
Where does it point?

The pointer is defined globally, outside of any function or statement block. It points to a memory location (an address) of an integer: int* input

Since it is defined globally, I figured I could use it in my function as well.

So, crt0 helpfully initialised your pointer to point to memory address zero.
What do you have at memory address zero?

Also, you may want to check the documentation for "atoi"