collect2.exe: error: ld returned 1 exit status

Hey, i have no clue what i’m doing and i’m tying to do it anyway. I got this code

#include <SoftwareServo.h>
#include <SoftwareSerial.h>
#include <VirtualWire.h>
#include <ServoTimer2.h>

//#define DEBUG_MODE

ServoTimer2 myservo1;
SoftwareServo myservo2;
SoftwareServo myservo3;
SoftwareServo myservo4;

const int numberOfAnalogPins = 4; // how many analog integer values to receive
int data[numberOfAnalogPins]; // the data buffer
int value[numberOfAnalogPins];
// the number of bytes in the data buffer
const int dataBytes = numberOfAnalogPins * sizeof(int);
byte msgLength = dataBytes;

void setup() {
  myservo1.attach(9);  //Propeller
  myservo2.attach(10);  //Rudder
  myservo3.attach(8);  // Ailron
  myservo4.attach(12);   // Elevator

  Serial.begin(9600);

#ifdef DEBUG_MODE
  Serial.println("Ready");
#endif

  // Initialize the IO and ISR
  vw_set_ptt_inverted(true); // Required for DR3100
  vw_setup(2000); // Bits per sec
  vw_set_rx_pin(11);  
  vw_rx_start(); // Start the receiver
}


void loop(){

  if (vw_get_message((byte*)data, &msgLength))  {    // Non-blocking

#ifdef DEBUG_MODE  
  Serial.println("Got: ");
#endif

  if(msgLength == dataBytes){
  for (int i = 1; i < numberOfAnalogPins; i++) {

#ifdef DEBUG_MODE    
  Serial.print("pin ");
  Serial.print(i);
  Serial.print("=");
  Serial.println(data[i]);
#endif
  value[0]=map(data[0],0,1023,1000,2000);
  
  value[i]=map(data[i],0,1023,0,179);  // Write into the servo
  }
  
  myservo1.write(value[0]);
  myservo2.write(value[1]);
  myservo3.write(value[2]);
  myservo4.write(value[3]);
  delay(50);
  SoftwareServo::refresh();   //refresh the servo
  }
  else {
#ifdef DEBUG_MODE    
  Serial.print("unexpected msg length of ");
  Serial.println(msgLength);
#endif
  }
#ifdef DEBUG_MODE      
  Serial.println();
#endif
  }
}
//::loseSomeTime(4000)

.
and I get these errors
C:\Users\Kids\AppData\Local\Temp\ccffnZNw.ltrans0.ltrans.o: In function `__static_initialization_and_destruction_0’:

C:\Users\Kids\AppData\Local\Temp\Temp5_Arduplane.zip\Arduplane\receiver\receiver_2/receiver_2.ino:10: undefined reference to `SoftwareServo::SoftwareServo()’

C:\Users\Kids\AppData\Local\Temp\Temp5_Arduplane.zip\Arduplane\receiver\receiver_2/receiver_2.ino:11: undefined reference to `SoftwareServo::SoftwareServo()’

C:\Users\Kids\AppData\Local\Temp\Temp5_Arduplane.zip\Arduplane\receiver\receiver_2/receiver_2.ino:12: undefined reference to `SoftwareServo::SoftwareServo()’

C:\Users\Kids\AppData\Local\Temp\ccffnZNw.ltrans0.ltrans.o: In function `setup’:

C:\Users\Kids\AppData\Local\Temp\Temp5_Arduplane.zip\Arduplane\receiver\receiver_2/receiver_2.ino:23: undefined reference to `SoftwareServo::attach(int)’

C:\Users\Kids\AppData\Local\Temp\Temp5_Arduplane.zip\Arduplane\receiver\receiver_2/receiver_2.ino:24: undefined reference to `SoftwareServo::attach(int)’

C:\Users\Kids\AppData\Local\Temp\Temp5_Arduplane.zip\Arduplane\receiver\receiver_2/receiver_2.ino:25: undefined reference to `SoftwareServo::attach(int)’

C:\Users\Kids\AppData\Local\Temp\ccffnZNw.ltrans0.ltrans.o: In function `loop’:

C:\Users\Kids\AppData\Local\Temp\Temp5_Arduplane.zip\Arduplane\receiver\receiver_2/receiver_2.ino:64: undefined reference to `SoftwareServo::write(int)’

C:\Users\Kids\AppData\Local\Temp\Temp5_Arduplane.zip\Arduplane\receiver\receiver_2/receiver_2.ino:65: undefined reference to `SoftwareServo::write(int)’

C:\Users\Kids\AppData\Local\Temp\Temp5_Arduplane.zip\Arduplane\receiver\receiver_2/receiver_2.ino:66: undefined reference to `SoftwareServo::write(int)’

C:\Users\Kids\AppData\Local\Temp\Temp5_Arduplane.zip\Arduplane\receiver\receiver_2/receiver_2.ino:68: undefined reference to `SoftwareServo::refresh()’

collect2.exe: error: ld returned 1 exit status

)
exit status 1
Error compiling for board Arduino/Genuino Uno.

can any one help?

I suspect you incorrectly installed the SoftwareServo library. You can't just install the SoftwareServo.h file only. You need to install all files of the library.

Can servo library replace softwareservo library?

thankyou I reinstalled softwareservo and it works now. I'm geting a different error now though, from what I found I need to manualy get drivers for nano.

Please do this:

  • When you encounter an error, you’ll see a button on the right side of the orange bar “Copy error messages” in the Arduino IDE (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button…
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum’s code tags markup to your reply.
  • Press “Ctrl + V”. This will paste the error between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.

If the text exceeds the forum’s 9000 character limit, save it to a .txt file and podst it as an attachment. If you click the “Reply” button here, you will see an “Attachments and other settings” link.

Sorry for the wait . It’s the same code with this error.

error 1.doc (80.5 KB)

Please post it again as a .txt file. I don't have any software installed to open a .doc file.

Here you are :slight_smile:

error 1.txt (40.7 KB)

Select Tools > Processor > ATmega328P (Old Bootloader) and the try uploading again.

flyingsquirrle's error message:

Arduino: 1.8.8 (Windows 7), Board: "Arduino Nano, ATmega328P"
Sketch uses 5382 bytes (17%) of program storage space. Maximum is 30720 bytes.
Global variables use 345 bytes (16%) of dynamic memory, leaving 1703 bytes for local variables. Maximum is 2048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x1d
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x1d
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x1d
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x1d
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x1d
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x1d
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x1d
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x1d
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x1d
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x1d
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

that worked thank you! the wireing is still working,I think rf modules bad :confused: >:(

A post was split to a new topic: Generic STM32F4 Trouble