Esp32-snippets: undefined reference to `app_main

Created on 6 Nov 2017  路  6Comments  路  Source: nkolban/esp32-snippets

when I am running make all in command window I am getting this error as:
screenshot from 2017-11-06 12-21-54

I tried to change the code from extern void app_main(void) as extern "C" void app_main(void); in cpu_start.c file. Still id didn't work.

please help out with this.
Thank you.

Most helpful comment

Im guessing you just copied SampleClient.cpp from example folder to main folder. Esp-idf application requires entry point to start, by default it is void app_main(). You have few options now.

  1. create main.cpp with this code:
extern void SampleClient();
extern "C" {
void app_main();
}
void app_main(){
SampleClient();
}
  1. at the end of SampleClient.cpp add:
extern "C" {
void app_main();
}
void app_main(){
SampleClient();
}

There is few other options but those 2 are simplest.

All 6 comments

Please show output of: ll main

@chegewara when I am typing in command window: II main, it giving as command not found.

then ls -al main

screenshot from 2017-11-06 12-41-13

Im guessing you just copied SampleClient.cpp from example folder to main folder. Esp-idf application requires entry point to start, by default it is void app_main(). You have few options now.

  1. create main.cpp with this code:
extern void SampleClient();
extern "C" {
void app_main();
}
void app_main(){
SampleClient();
}
  1. at the end of SampleClient.cpp add:
extern "C" {
void app_main();
}
void app_main(){
SampleClient();
}

There is few other options but those 2 are simplest.

Wow @chegewara your awesome it is working now. I am able to run the program.
Thank you for your support.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

HarrisonOfTheNorth picture HarrisonOfTheNorth  路  8Comments

d3cline picture d3cline  路  4Comments

vicatcu picture vicatcu  路  4Comments

Lakoja picture Lakoja  路  8Comments

jim-ber picture jim-ber  路  8Comments