Go Down

Topic: Odd problem when using a sketch in Linux (Read 106 times) previous topic - next topic


I wonder if anyone else has had this problem. Installed Arduino IDE on both Windows 7 and Linux Mint. Works in both OSs. BUT some sketches fail. This one in particular dealing with touchscreen. Works fine in Windows, but has errors in Linux. Posting errors here. In file included from /home/sjp/Arduino/libraries/TFTLCD-Library-master/Adafruit_TFTLCD.cpp:19:0:
/home/sjp/Arduino/libraries/TFTLCD-Library-master/pin_magic.h:282:33: warning: backslash and newline separated by space
   #define read8inline(result) { \   
/home/sjp/Arduino/libraries/TFTLCD-Library-master/Adafruit_TFTLCD.cpp:803:0: warning: "read8" redefined
   #define read8(x) x=read8fn()
In file included from /home/sjp/Arduino/libraries/TFTLCD-Library-master/Adafruit_TFTLCD.cpp:19:0:
/home/sjp/Arduino/libraries/TFTLCD-Library-master/pin_magic.h:183:0: note: this is the location of the previous definition
   #define read8             read8inline
/home/sjp/Arduino/libraries/TFTLCD-Library-master/Adafruit_TFTLCD.cpp: In member function 'void Adafruit_TFTLCD::begin(uint16_t)':
/home/sjp/Arduino/libraries/TFTLCD-Library-master/pin_magic.h:401:21: warning: large integer implicitly truncated to unsigned type [-Woverflow]
   hi = (d) >> 8; lo = (d); CD_DATA   ; write8(hi); write8(lo); }
/home/sjp/Arduino/libraries/TFTLCD-Library-master/pin_magic.h:187:29: note: in expansion of macro 'writeRegister16inline'
   #define writeRegister16   writeRegister16inline
/home/sjp/Arduino/libraries/TFTLCD-Library-master/Adafruit_TFTLCD.cpp:283:5: note: in expansion of macro 'writeRegister16'
     writeRegister16(ILI9341_VCOMCONTROL1, 0x2B2B);

Not sure what is going on. I have the same libraries installed on both, using the exact same sketch in both. These errors only occur in Linux. Any ideas would be greatly appreciated.


You need to understand the difference between warnings and errors. A warning is the compiler telling you there is something in the code that could possibly cause a problem but doesn't cause the compilation to fail. An error is a problem with the code that causes compilation to fail. In this case you have posted warnings not errors.

You should always pay attention to warnings and fix them in your own code whenever possible. Unfortunately some library authors don't hold themselves to such high standards so sometimes you do just need to ignore a warning from a library that you didn't write. That can be quite annoying since you are always having to sort though a bunch of warnings in other people's sloppy code to make sure your own code is of high quality. You may decide it's worth editing the source of the library to fix the warning. If you do so, it's a good idea to submit a pull request for the fix to the library's repository to solve the problem upstream, otherwise the warnings will come back whenever you update to a new release of the library. This will also benefit all the other users of the library.

My guess is that you're seeing these on Linux because you have File > Preferences > Compiler warnings set to something other than "None" and you're not seeing them on Windows because you have compiler warnings turned off there.


It's also possible that you use a different compiler version. Some code that in the past did not generate warnings will on newer versions result in these warnings.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Go Up