compile error with 74hc166 Shift Register

Hey guys please help me out. i keep getting the error.
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling with Arduino Uno.

I tried to use another arduino but the issue continued, im not sure if its the code that is faulty. im trying to make te SR work with some switchs. any ideas ?

int ioSelect =2; //Pin 15
int clockPulse = 3; //Pin 7
int dataOut = 4; // pin 13

int j;
int switchstate;

byte switchVar = 0;

void setup() {

pinMode(ioSelect, OUTPUT);
pinMode(clockPulse, OUTPUT);
pinMode(dataOut, INPUT);



void Loop() {

byte dataIn = 0;
digitalWrite(ioSelect,0); // enables inputs
digitalWrite(clockPulse,0); // start pin low
digitalWrite(clockPulse,1); // set clock pin high, data goes in SR
digitalWrite(ioSelect,1); // deisable the parallel serial output

// we enabled the SR to take in data

for (j = 0; j<8;j++){ //sets a value from 0-7
switchstate = digitalRead (dataOut); //reads the data from SR
Serial.print("Button Position: ");
Serial.print("Button Value: ");
if (switchstate){
int a = (1<<j);

dataIn=dataIn; //| a;

if (switchVar != dataIn){
switchVar = dataIn;
Serial.print("dataIn DEC: ");
Serial.print(dataIn, DEC);
Serial.print("dataIn BIN: ");
Serial.print(dataIn, BIN);


collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling with Arduino Uno.

This is just the generic error that means something went wrong. There are a near infinite number of possible causes of this error message. You need to scroll up the black console pane at the bottom of the Arduino IDE window and look at the specific error messages that will tell you what is wrong.

If you do that and are still unable to find the problem, you’ll need to provide us with the full and exact error output:

  • 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 post it as an attachment. If you click the “Reply” button here, you will see an “Attachments and other settings” link that will allow you to make the attachment.

void Loop() {Oops

(It’s a linker error, not a compiler error)

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.