Arduino Programm don't want to compile

Hi there, i've written a little code and after i compiled it it gaves me this massage:

collect2.exe: error: ld returned 1 exit status

what can i do? the only thing i found out is that the program works if i put away the first librarie. but in an other sotfware, this librarie works perfektly (mthread)...

my program can be downloaded here:

Edit: i use the Arduino Mega 2560

Hope somebody can help me quickly... timo :)

Your title reminds me of the joke “How many psychiatrists does it take to change a light bulb? One, but only if it wants to change”

Post your code here so we can see it easily.
And please use the code button </>

so your code looks like this

and is easy to copy to a text editor

And most importantly, post the error message.


Here the code:

#include <Drive_Software_mthread.h>
#include <mthread.h>

#include <SPI.h>
#include <Servo.h>
#include <RA8875.h>

By using 4 wire SPI, so:
 Arduino Uno:
 MOSI:  11
 MISO:  12
 SCK:   13
 Arduino Mega:
 MOSI:  51
 MISO:  50
 SCK:   52
the rest of the pin's below: 

#define RA8875_CS     49
#define RA8875_RESET  48
#define RA8875_INT    47
RA8875 tft = RA8875(RA8875_CS, RA8875_RESET);

#define verbrennerPort 3
#define elektroPort 4
#define servo1Port 5
#define servo2Port 6

//Gear settings
static struct gear {
  const int Neutral1 = 90, Neutral2 = 90, Drive1 = 70, Drive2 = 110, Drive3 = 70, Drive4 = 110;
} gear;

Servo servo1;
Servo servo2;

void setup() {

  main_thread_list->add_thread(new Display_Thread_Drive());
  main_thread_list->add_thread(new Steuerung_Thread_Drive());
  main_thread_list->add_thread(new Touch_Thread_Drive());


void loop() {
  int i;





bool gearput(int currentgear){
  switch (currentgear) {
    case (0): servo1.write(gear.Neutral1); servo2.write(gear.Neutral2);
    case (1): servo1.write(gear.Drive1); servo2.write(gear.Neutral2);
    case (2): servo1.write(gear.Drive2); servo2.write(gear.Neutral2);
    case (3): servo1.write(gear.Neutral1); servo2.write(gear.Drive3);
    case (4): servo1.write(gear.Neutral1); servo2.write(gear.Drive4);
    default: servo1.write(gear.Neutral1); servo2.write(gear.Neutral2);

The code is really important for a school project, so it really needs to work…

Stay away from threads, do it all manually.

The demo Several Things at a Time illustrates how to manage thinsg without needing any external libraries.

It is very easy to spend longer trying to understand (or fix) a library than the time you spend on your own problem.


void loop() {
  int i;


Did you forget a "static" keyword there?