我正在使用 mbed 框架在 Platformio 中开发一个项目,我在编译的二进制文件中找到了我的计算机路径,例如:
00010440h: 9E 46 70 47 43 3A 5C 55 73 65 72 73 5C 47 47 47 ; žFpGC:\Users\Ggg
00010450h: 5C 2E 70 6C 61 74 66 6F 72 6D 69 6F 5C 70 61 63 ; \.platformio\pac
00010460h: 6B 61 67 65 73 5C 66 72 61 6D 65 77 6F 72 6B 2D ; kages\framework-
00010470h: 6D 62 65 64 2F 70 6C 61 74 66 6F 72 6D 2F 53 69 ; mbed/platform/Si
00010480h: 6E 67 6C 65 74 6F 6E 50 74 72 2E 68 00 70 20 3D ; ngletonPtr.h.p =
00010490h: 3D 20 72 65 69 6E 74 65 72 70 72 65 74 5F 63 61 ; = reinterpret_ca
000104a0h: 73 74 3C 54 20 2A 3E 28 26 5F 64 61 74 61 29 00 ; st<T *>(&_data).
我可以在上述文件中找到错误字符串,它指向 .platformio\packages\framework-mbed\platform\mbed_error.h。这个文件说
/** Define this macro to include filenames in error context. For release builds, do not include filename to save memory.
* MBED_PLATFORM_CONF_ERROR_FILENAME_CAPTURE_ENABLED
*/
所以我尝试在发布模式下编译,但没有任何变化。我还尝试将它放在我的 main.cpp 之上:
#undef MBED_PLATFORM_CONF_ERROR_FILENAME_CAPTURE_ENABLED
#undef MBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED
请注意,有 2 个类似的定义,我在我的构建目录中的自动生成(因此不可编辑)mbed_config.h 中找到了另一个,我相信这是正确的,因为我可以找到它用于 mbed_error .h (因此该文件顶部的注释是错误的)。
我尝试在我能想到的所有路径中找到该定义,但我找不到自动生成 mbed_config.h 文件的代码。
我也试过
#define MBED_CONF_PLATFORM_MAX_ERROR_FILENAME_LEN 1
但它仍然显示完整路径。
如何在不显示文件完整路径的情况下编译我的二进制文件?