How is the app_httpd.cpp called?

In the ESP32 example CameraWebServer are two files "app_httpd.cpp" and "ci.json". These two files are not referenced or called by the other 3 files. How does the webserver know that it should call the app_httpd when receiving a response from the browser? And when/how is the ci.json called?

The server is set up with the call to startCameraServer() from the setup() function. startCameraServer() is in 'app_httpd.cpp'.

I think 'ci.json' is used by the build environment to set options for the ESP32. It's not part of the actual code.

Okay, maybe httpd_start() (inside startCameraServer()) knows from which cpp it was invoked, but I can't read that in the API reference.

New question.
There is no #include app_httpd.cpp in the CameraWebServer.ino. So how does CameraWebServer.ino knows that it can find startCameraServer() in the app_httpd.cpp?

From the function's signature near the top of "CameraWebServer.ino":
void startCameraServer();
That lets the linker know it will need to look for that function after all other files in the project are compiled.

You don't #include .cpp files. Doing so could result in multiple definition errors for variables and functions. Take a look at My Post #5 in this Thread to gain a basic understanding of multi-file projects.

What does that mean?

@gfvalvo Okay I get it. Thank you for your answer.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.