Create and use external component

Kniroxe
Posts: 2
Joined: Mon Sep 16, 2024 11:53 pm

Create and use external component

Postby Kniroxe » Mon Sep 23, 2024 6:00 pm

Hi, I'm trying to use the following component: "https://github.com/bitfixer/esp32s3vga/tree/main". I created the folder for components and made the necessary changes in the CMakeLists.txt to add it. The problem occurs when I try to build it: if I keep the main.c file as a C file, the compiler treats VGA.h as a C file as well and doesn't recognize the type name 'class'. However, if I change main.c to main.cpp, the compiler recognizes 'class' but then I get the error "undefined reference to 'app_main'".

I’m not sure why it won't let me compile in C++, even after changing the CMakeLists.txt to reference main.cpp. If anyone knows how to work with C++ files in this context, could you help me out?

nopnop2002
Posts: 109
Joined: Thu Oct 03, 2019 10:52 pm
Contact:

Re: Create and use external component

Postby nopnop2002 » Tue Sep 24, 2024 5:40 am

If you change main.c to main.cpp, the following changes are required.

https://docs.espressif.com/projects/esp ... splus.html

MicroController
Posts: 1698
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Create and use external component

Postby MicroController » Tue Sep 24, 2024 7:35 am

Kniroxe wrote:
Mon Sep 23, 2024 6:00 pm
I get the error "undefined reference to 'app_main'".
Specifically, in C++, app_main() must be declared extern "C", see https://docs.espressif.com/projects/esp ... -main-in-c

Who is online

Users browsing this forum: Bing [Bot] and 214 guests