Closed
Description
Hello everyone
i want to create a library but want to use it with archive file.
i create a test library and i got some error while compile.
Steps, I followed:
- Create Library structure
{Library name (test)}/
example/
test.ino
src/
esp8266/
libtest.a
test.h
- create test.h , test.cpp and test.ino file
test.h file
#ifndef TEST_H
#define TEST_H
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#define NAME "AGLOW"
void name();
void data();
#endif
test.cpp
#include <test.h>
void name() {
Serial.print(NAME);
}
void data() {
Serial.print(NAME);
}
test.ino file
#include <test.h>
void setup() {
Serial.begin(115200);
name();
}
void loop() {}
-
I compile the code with
dot_a_linkage=true
then i will get thetest.a
file in temporary folder . -
now i delete the
test.cpp
file and addtest.a
file inside the esp8266 folder as mentioned above. -
and change the
test.a
file name tolibtest.a
-
now i compile the code with this
library.properties
, but nothing works
name=TEST
version=1.0.0
author=Vipul Garg
maintainer=Vipul Garg
sentence=A library use to do
paragraph=Supports HTTPS1.1
category=Communication
url=https://xyz.com
architectures=esp8266
includes=test.h
precompiled=true
ldflag=-ltest
- i got this below error
Used: /Users/vipulgarg/Documents/Arduino/libraries/test
/Users/vipulgarg/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: /var/folders/4p/d03ndbt94pj3bw26wnzvly580000gn/T/arduino_build_447457/sketch/test1.ino.cpp.o:(.text.setup+0x8): undefined reference to `name()'
/Users/vipulgarg/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/2.5.0-4-b40a506/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld: /var/folders/4p/d03ndbt94pj3bw26wnzvly580000gn/T/arduino_build_447457/sketch/test1.ino.cpp.o: in function `setup':
/Users/vipulgarg/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.1/cores/esp8266/HardwareSerial.h:76: undefined reference to `name()'
collect2: error: ld returned 1 exit status
- if i add test.cpp again in the src folder everything works fine.
Please help me out i have tried for more than 5 days still got error.
my test library is attached to this issue.