I'm facing a problem when I try to compile an existing project which I'm basically trying to readapt to work with the new version of ESP-IDF V4.0 (the previous one was V3.3).
I noticed that the new development environment uses CMake in order to get the app running so, maybe my "inexperience" is the problem.
When I submit idf.py build flash I get these compilation errors:
app_main.cpp
Code: Select all
FAILED: app.elf
cmd.exe /C "cd . && C:\Users\leofa\.espressif\tools\xtensa-esp32-elf\esp-2019r2-8.2.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-g++.exe --sysroot=c:\development\esp/../xtensa-esp32-elf/xtensa-esp32-elf -mlongcalls -Wno-frame-address -nostdlib @CMakeFiles\app.elf.rsp -o app.elf && cd ."
c:/users/leofa/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(app_main.cpp.obj):(.literal.app_main+0xc): undefined reference to `MyConfig'
c:/users/leofa/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(app_main.cpp.obj):(.literal.app_main+0x14): undefined reference to `MyCommandApp'
c:/users/leofa/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(app_main.cpp.obj):(.literal.app_main+0x24): undefined reference to `AddTaskToMap(void*)'
c:/users/leofa/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(app_main.cpp.obj):(.literal.app_main+0x28): undefined reference to `AppConfig::mount()'
c:/users/leofa/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(app_main.cpp.obj):(.literal.app_main+0x2c): undefined reference to `AppCommandApp::ConfigureLogging()'
c:/users/leofa/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(app_main.cpp.obj):(.literal.app_main+0x30): undefined reference to `Housekeeping::Housekeeping()'
c:/users/leofa/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/main/libmain.a(app_main.cpp.obj): in function `app_main':
C:\development\app\build/../main/app_main.cpp:56: undefined reference to `AddTaskToMap(void*)'
c:/users/leofa/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\development\app\build/../main/app_main.cpp:59: undefined reference to `AppConfig::mount()'
c:/users/leofa/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\development\app\build/../main/app_main.cpp:62: undefined reference to `AppCommandApp::ConfigureLogging()'
c:/users/leofa/.espressif/tools/xtensa-esp32-elf/esp-2019r2-8.2.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: C:\development\app\build/../main/app_main.cpp:68: undefined reference to `Housekeeping::Housekeeping()'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
- CMakeLists.h
- components
- main
-- app_config.cpp
-- app_config.h
-- app_housekeeping.cpp
-- app_housekeeping.h
-- app_commands.cpp
-- app_commands.h
-- app_main.cpp
-- CMakeLists.txt
-- component.mk
CMakeLists.txt outside "main":
Code: Select all
cmake_minimum_required(VERSION 3.5)
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(MDF_VER command bash -c "cd $ENV{MDF_PATH} && git describe --always --tags --dirty")
#CPPFLAGS := -D MDF_VER=\"$(MDF_VER)\"
set(EXTRA_COMPONENT_DIRS $ENV{MDF_PATH}/components $ENV{MDF_PATH}/components/third_party)
#set(EXTRA_COMPONENT_DIRS ${EXTRA_COMPONENT_DIRS} )
message(STATUS "EXTRA_COMPONENT_DIRS: ${EXTRA_COMPONENT_DIRS}")
set(CMAKE_SYSROOT $ENV{IDF_PATH}/../xtensa-esp32-elf/xtensa-esp32-elf)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(app)
Code: Select all
idf_component_register(SRCS "app_main.cpp"
INCLUDE_DIRS ".")
Some help would be very appreciated. Thank you in advance