0

I am working in an Arduino project in visual studio. I need to get and set time to a RTC clock. That's why I am adding a ds3231 header file in my project from GitHub. When I want to build "it's showing me linking error.

cccSeqVu.ltrans0.o*: (.text.startup+0x1ea): undefined reference to DS3231_init(unsigned char)

My code is given below.

#include <Wire.h>
#include "ds3231.h"
  
void setup(){
    Wire.begin();
    DS3231_init(0x4);
}

void loop(){
}

Can anyone please help me to find out what I have missed.

2
  • Did you add the rest of the project or just the header file? If it's failing at linking it implies you haven't built the .cpp file Commented Jan 8, 2023 at 16:36
  • I have only added header file. Is there anything else need to add ? Commented Jan 8, 2023 at 16:41

1 Answer 1

1

You need to add the whole git project as a library, then include the header file.

The header file is just the list of function names and constants, with out the corresponding cpp file there is no actual implementation of the library that knows how to talk to the RTC.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.