Hello,
I saw a similar issues very often but somehow I could not solve my problem with existing answers.
I have a “Arduino style” structure with an exampe test program and internal library like this:
lib_problem
+---examples
| \---test_lib
| | platformio.ini
| \---src
| test_problem.cpp
+---include
| libproblem.h
\---src
libproblem.cpp
When I compile test_problem (opened test_lib examples folder in VSCode) the includes of the libary are found. However the libproblem library is not compiled and the linker finally has an error:
lib_problem\examples\test_lib/src/test_problem.cpp:6: undefined reference to `CLibProblem::CLibProblem()'
Here are my small test sources:
platformio.ini:
[platformio]
default_envs = featheresp32
;lib_extra_dirs = ${PROJECT_DIR}/../..
lib_dir = ${PROJECT_DIR}/../..
[env]
;lib_ldf_mode = deep+
;build_flags = -Llib_problem
[env:featheresp32]
; HW
platform = espressif32
board = featheresp32
framework = arduino
test_problem.cpp
#include <Arduino.h>
#include "libproblem.h"
void setup()
{
CLibProblem *lp = new CLibProblem();
return;
}
void loop()
{
delay(10000);
}
#if !CONFIG_AUTOSTART_ARDUINO
void app_main()
{
setup();
}
#endif
libproblem.h:
class CLibProblem {
public:
CLibProblem();
};
and libproblem.cpp:
#include "LibProblem.h"
CLibProblem::CLibProblem()
{
}
Thank you in advance for the support.
mawi