Arm Mbed and Pelion Device Management support forum

Would be better to give config.h a different filename

The mbedTLS configuration file config.h, in my current project, conflicts with the GTK configuration file, which happens to be config.h as well. In the GTK code, the #include <config.h> is part of automatically generated GUI code. It would be better if mbedTLS can use something different, mbedtls_config.h would be much better than the plain config.h.

Hi @acpie360
Thank you for your feedback!

Renaming the configuration file will have serious consequences in matter of backwards compatibility.
However, as you can see in the code, every source file has the following lines:

#if !defined(MBEDTLS_CONFIG_FILE)
#include "mbedtls/config.h"
#else
#include MBEDTLS_CONFIG_FILE
#endif

This means that you can rename the file in your project and define MBEDTLS_CONFIG_FILE (as a compilation flag -DMBEDTLS_CONFIG_FILE=<path \name of new file>). This was the original intention of MBEDTLS_CONFIG_FILE, to avoid such cases of duplication.
Regards,
Mbed TLS Support
Ron

Ron, thank you!

I got it fixed as you suggested - I renamed config.h in the mbedTLS’s include folder to mbedtls_config.h, then added

MBEDTLS_CONFIG_FILE=\"mbedtls_config.h\"

in Visual Studio’s Preprocessor Definitions.