Re: It Builds! (Re: Building from the source files. Library location.)

Garry48
 

Dave G8KBV,

Reference:

One more question, re the glcd library used here.  Does the file
'ks0108_Arduino.h' "Need" to be in the glcd lib' folder, or as it is an included file within the >sketch, and sketch folder, will the configuration be picked up from there?

The file 'ks0108_Arduino.h' should be placed in the glcd/include subdirectory.  It is code specific to the glcd library.  Mr. Farhan should have already re-compiled the glcd library. Dependencies in the glcd library should cause it to be re-compiled it any changes are made to the files that build the glcd library. At least that is what should happen.

When compiling and linking there is an order to the search paths.  Here is the gcld example:

ResolveLibrary(glcd.h)
  -> candidates: [glcd]
"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=atmega328p -DF_CPU=16000000L -DARDUINO=10810 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\eightanaloginputs" "-IC:\\Users\\MyUser\\Documents\\Arduino\\Sketches\\libraries\\glcd" "C:\\Users\\MyUser\\AppData\\Local\\Temp\\arduino_build_976861\\sketch\\antenna_analyzer_p3.ino.cpp" -o nul

The include paths are defined as follow using the -I directive:

"-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino"

"-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\eightanaloginputs"

"-IC:\\Users\\MyUser\\Documents\\Arduino\\Sketches\\libraries\\glcd"

So to get glcd built properly, the 'ks0108_Arduino.h' file should be placed in the glcd subdirectory structure.  Since there is an include subdirectory, I dropped it in with all of the other include files.  Somehow the compiler & linker knows how to find it; since it compiles and links without errors.

Related:  If I should use that library for other projects, using
'standard' interconnections, is that "modified" library OK for that, or should I use the Adafuit >version from the IDE download site?   If so, how best to keep them segregated?

The glcd library was included in the antuino 2.1 sketch 'only'! It is not available for any other sketches you may compile.  My suggestion is to use the library manager (TOOLS ->  MANAGE LIBRARIES) and install the 'latest distribution' glcd or lcd library for the display you are using.  This insures you are NOT using an outdated/modified library (in this case the glcd included in the Antuino archive).  Using old or modified libraries will cause you hours of chasing/hunting 'undefined symbols, routines', etc!  It is not worth the effort!

Yes, keep them segregated!  The worst thing you can do is mix two versions together.  Ultimately you will end up erasing both and downloading them again (or extracting them out of your configuration management system) and recompiling/linking.

HTH

Garry / WD0DUD, Ex real-time Lead Software Engineer (Flight Simulation)

Join Antuino@groups.io to automatically receive all group messages.