Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TW#28162] Include file esp_https_server.h misses 'extern "C"' when included in C++ sources #2887

Closed
i-franzki opened this issue Dec 26, 2018 · 1 comment
Labels
Type: Feature Request Feature request for IDF

Comments

@i-franzki
Copy link

Environment

  • Development Kit: ESP32-PICO-Kit
  • Module or chip used: ESP32-PICO-D4
  • IDF version v3.3-beta1-134-g1023ff73f
  • Build System: Make
  • Compiler version: 1.22.0-80-g6c4433a5
  • Operating System: Windows
  • Power Supply: USB

Problem Description

The include file esp_https_server.h misses the extern "C" { so that it can be included from C++ files:

#ifdef __cplusplus
extern "C" {
#endif

...

#ifdef __cplusplus
}
#endif

Other include files (e.g. esp_http_server.h) already have the extern "C" {.

When missing, the compile works, but the linker does not find the httpd_ssl_start() and httpd_ssl_stop() functions, because they are not available in the C++ namespace.

Expected Behavior

Be able to include esp_https_server.h in C++ source files.

Actual Behavior

Link errors with functions httpd_ssl_start() and httpd_ssl_stop() when included from C++ source files.

Steps to repropduce

See below.

Code to reproduce this issue

USe example '/protocols/https_server' but within an C++ source file:
https://github.com/espressif/esp-idf/blob/master/examples/protocols/https_server/main/main.c

Debug Logs

LD build/test.elf
C:/Msys32/home/ifranzki/esp/test/build/main\libmain.a(httpd.o):(.literal._Z16httpd_initializev+0x48): undefined reference to `httpd_ssl_start(void**, httpd_ssl_config*)'
C:/Msys32/home/ifranzki/esp/test/build/main\libmain.a(httpd.o):(.literal._Z15httpd_terminatev+0x0): undefined reference to `httpd_ssl_stop(void*)'
C:/Msys32/home/ifranzki/esp/test/build/main\libmain.a(httpd.o): In function `httpd_initialize()':
C:/Msys32/home/ifranzki/esp/test/main/httpd.cpp:347: undefined reference to `httpd_ssl_start(void**, httpd_ssl_config*)'
C:/Msys32/home/ifranzki/esp/test/build/main\libmain.a(httpd.o): In function `httpd_terminate()':
C:/Msys32/home/ifranzki/esp/test/main/httpd.cpp:354: undefined reference to `httpd_ssl_stop(void*)'
collect2.exe: error: ld returned 1 exit status
make: *** [C:/Msys32/home/ifranzki/esp/esp-idf/make/project.mk:458: /home/ifranzki/esp/test/build/test.elf] 

Other items if possible

None

@Alvin1Zhang Alvin1Zhang changed the title Include file esp_https_server.h misses 'extern "C"' when included in C++ sources [TW#28162] Include file esp_https_server.h misses 'extern "C"' when included in C++ sources Dec 27, 2018
@suda-morris suda-morris added the Type: Feature Request Feature request for IDF label Dec 27, 2018
@anurag-kar
Copy link
Contributor

@i-franzki Thanks for notifying this issue. Fix will be available soon.

@igrr igrr closed this as completed in a6f18bd Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Request Feature request for IDF
Projects
None yet
Development

No branches or pull requests

3 participants