Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Help with #include problem (Read 924 times)
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
Help with #include problem
Jul 6th, 2020 at 10:50pm
Print Post  
I have been using the SBWire library for I2C comms instead of the standard Arduino Wire library due to a long-standing bug in Wire that causes intermittent hangups.  Now the Wire library has been modified to address this bug and I am trying to change back from SBWire to Wire, but my project keeps insisting on loading the SBWire library AND the Wire library, with predictable (bad) results.

I swear I have gone through each and every #include file and commented out/deleted any references to SBWire.h, but for some reason I still see lots of lines in the verbose compile output where the SBWire library versions of twi.c are being loaded/compiled.

I have tried to work my way through the verbose compile output, looking for clues for what is triggering the SBWire file loads, but I can't find anything - although surely it is there somewhere.

Would someone mind taking a gander at the verbose compiler output (with build properties included) attached to this post, and maybe help me understand what a line like this one can tell me about what file is causing SBWire library loads?

Code
Select All
"C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560   -DF_CPU=16000000L -DARDUINO=108013 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega" -I"C:\Users\Frank\Documents\Arduino\libraries\NewPing\src" -I"C:\Users\Frank\Documents\Arduino\libraries\elapsedMillis" -I"C:\Users\Frank\Documents\Arduino\libraries\PrintEx\src" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src" -I"C:\Users\Frank\Documents\Arduino\libraries\I2C_Anything" -I"C:\Users\Frank\Documents\Arduino\libraries\RTClib" -I"C:\Users\Frank\Documents\Arduino\libraries\PID" -I"C:\Users\Frank\Documents\Arduino\libraries\RTClib\utility" -I"C:\Users\Frank\Documents\Arduino\libraries\SBWire\src" "C:\Users\Frank\Documents\Arduino\libraries\SBWire\src\utility\twi.c" -o "nul" 



TIA,

Frank
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Help with #include problem
Reply #1 - Jul 7th, 2020 at 1:28am
Print Post  
I see this in your output

Code
Select All
Using library RTClib version 1.7.0 in folder "file:///C:/Users/Frank/Documents/Arduino/libraries/RTClib"
 Ignoring external source 'RTClib.cpp' because it exists locally in the project.
 



That is because your project contains and RTClib.cpp and you are trying to use a library with the same .cpp file name.
  
Back to top
WWW  
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2174
Joined: Feb 13th, 2019
Re: Help with #include problem
Reply #2 - Jul 7th, 2020 at 1:26pm
Print Post  
Would it be possible to send us the sketch file, and a copy of the libraries in a zip file so we can investigate further?
  
Back to top
 
IP Logged
 
FrankP
Full Member
***
Offline


Posts: 240
Joined: Oct 19th, 2011
Re: Help with #include problem - Solved
Reply #3 - Jul 7th, 2020 at 7:41pm
Print Post  
Well, I finally figured it out.  "Way back when", I had manually modified RTCLib.cpp/.h to use SBWire vs Wire libraries.  I thought I had done it very cleverly with an added #define in the .h file and #ifdef's in the .cpp file to switch between SBWire.h & Wire.h, but apparently my later self was too clever for my earlier self, or maybe the other way around Wink.  Anyway, the #include SBWire line was still active, and this was causing the compile errors.

BTW, the way I finally conquered the way-too-voluminous 'verbose' compile output was to copy/paste the output into Notepad++, squeeze the font size down to TEEEENSSSyyy, and then spread the result across both of my 24"  2560 x 1440 monitors - and it STILL wasn't enough to prevent line wrap (and turning off line-wrap wasn't the answer either)!

However, it WAS enough to show me that a large part of each line was identical from line to line, so I could use Notepad++'s ALT-Select feature to remove the identical 'boilerplate' text from all lines, leaving only the portion actually relevant to the problem.

From this I was able to tell that each line added just one more library file to the mix, so I was able to follow the progress and carefully work my way through the library files in the same progression as the compiler.  Then I was able to find and fix my #include error in RTCLib and all was well. Whew!

Since I have had to to this several times now after descending into "#include hell" on different projects, I begin to wonder if there are some tools out there that can munch through an Arduino-style verbose output and selectively reduce the clutter to the point where a mere mortal such as myself could actually understand it.  Anyone know of such an animal?  If not, I'm seriously considering building such a tool myself.  Thoughts?

Frank
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint