eclipse / mraa

Linux Library for low speed IO Communication in C with bindings for C++, Python, Node.js & Java. Supports generic io platforms, as well as Intel Edison, Intel Joule, Raspberry Pi and many more.
http://mraa.io
MIT License
1.36k stars 613 forks source link

Patch to compile under bullseye with gcc10 (RaspberryPi debian standard) #1041

Open g-vidal opened 3 years ago

g-vidal commented 3 years ago

gcc10 introduces stronger regulations and the linker fails with duplicate gVERSION and gVERSION_SHORT definition error. The trick I have found is to make those variables extern in mraahome/include/version.h, here is the patch that worked for me, I do not know if it is the "right way" to handle the problem that's why I do not push a PR, I will if it is OK and helps.

--- include/version.h~  2020-11-10 19:47:03.734243366 +0100
+++ include/version.h   2020-11-11 10:43:19.870180059 +0100
@@ -11,8 +11,8 @@
 extern "C" {
 #endif

-const char* gVERSION;
-const char* gVERSION_SHORT;
+extern const char* gVERSION;
+extern const char* gVERSION_SHORT;

 #ifdef __cplusplus
 }