Multiple Files in Library folder

Hi everyone!

I have multiple files in my custom library folder, and I get this error when I try to compile:

TFT_Objects\TFT_Box.cpp.o: In function `TFT_Box::TFT_Box(UTFT*, UTouch*, UTFT_Geometry*)':
C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: multiple definition of `TFT_Box::TFT_Box(UTFT*, UTouch*, UTFT_Geometry*)'
TFT_Objects\TFT_Box.cpp.o:C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: first defined here
c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions
TFT_Objects\TFT_Box.cpp.o: In function `TFT_Box::TFT_Box(UTFT*, UTouch*, UTFT_Geometry*)':
C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: multiple definition of `TFT_Box::TFT_Box(UTFT*, UTouch*, UTFT_Geometry*)'
TFT_Objects\TFT_Box.cpp.o:C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: first defined here
TFT_Objects\TFT_Box.cpp.o: In function `TFT_Box::TFT_Box(UTFT*, UTouch*, UTFT_Geometry*)':
C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: multiple definition of `TFT_Box::sort()'
TFT_Objects\TFT_Box.cpp.o:C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: first defined here
TFT_Objects\TFT_Box.cpp.o: In function `TFT_Box::TFT_Box(UTFT*, UTouch*, UTFT_Geometry*)':
C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: multiple definition of `TFT_Box::sortReverse()'
TFT_Objects\TFT_Box.cpp.o:C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: first defined here
TFT_Objects\TFT_Box.cpp.o: In function `TFT_Box::TFT_Box(UTFT*, UTouch*, UTFT_Geometry*)':
C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: multiple definition of `TFT_Box::reverse()'
TFT_Objects\TFT_Box.cpp.o:C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: first defined here
TFT_Objects\TFT_Box.cpp.o: In function `TFT_Box::TFT_Box(UTFT*, UTouch*, UTFT_Geometry*)':
C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: multiple definition of `TFT_Box::shuffle()'
TFT_Objects\TFT_Box.cpp.o:C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: first defined here
TFT_Objects\TFT_Box.cpp.o: In function `TFT_Box::TFT_Box(UTFT*, UTouch*, UTFT_Geometry*)':
C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: multiple definition of `TFT_Box::lower()'
TFT_Objects\TFT_Box.cpp.o:C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: first defined here
TFT_Objects\TFT_Box.cpp.o: In function `TFT_Box::TFT_Box(UTFT*, UTouch*, UTFT_Geometry*)':
C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: multiple definition of `TFT_Box::upper()'
TFT_Objects\TFT_Box.cpp.o:C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: first defined here
TFT_Objects\TFT_Box.cpp.o: In function `TFT_Box::TFT_Box(UTFT*, UTouch*, UTFT_Geometry*)':
C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: multiple definition of `TFT_Box::size()'
TFT_Objects\TFT_Box.cpp.o:C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: first defined here
TFT_Objects\TFT_Box.cpp.o: In function `TFT_Box::TFT_Box(UTFT*, UTouch*, UTFT_Geometry*)':
C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: multiple definition of `TFT_Box::getItem(int, char*, int)'
TFT_Objects\TFT_Box.cpp.o:C:\Users\Giovanni\Documents\Arduino\libraries\TFT_Objects/TFT_Box.cpp:7: first defined here

/* + 300 lines of code of same nature */

Edit: ZIP with files attached.

My library folder looks like this (it is in the ...\Documents\Arduino):

TFT_Objects/
   keywords.txt
   TFT_Box.h
   TFT_Box.cpp
   TFT_Grid.h
   TFT_Grid.cpp
   utility/
      strFunctions.h
      strFunctions.cpp
      colorTheme.h
      colorTheme.cpp

TFT_ObjectsTest.ino file:

#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Geometry.h>
#include <TFT_Box.h>
#include <TFT_Grid.h>

UTouch        myTouch( 6, 5, 4, 3, 2);
UTFT          myGLCD(TFT01_32,38,39,40,41); 
UTFT_Geometry myGeo(&myGLCD);
TFT_Box       myComboBox(&myGLCD, &myTouch, &myGeo);
TFT_Grid      myListBox(&myGLCD, &myTouch);

/* code */

TFT_Box.h :

# ifndef TFT_Box_h
# define TFT_Box_h

#include <Arduino.h>
#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Geometry.h>
#include <string.h>
#include "utility/colorTheme.h"
#include "utility/strFunctions.h"

class TFT_Box {
  /* code */
}

#endif

TFT_Grid.h :

# ifndef TFT_Grid_h
# define TFT_Grid_h

#include <Arduino.h>
#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Geometry.h>
#include <string.h>
#include "utility/colorTheme.h"
#include "utility/strFunctions.h"

class TFT_Grid {
  /* code */
}

#endif

strFunctions.h:

#ifndef strFunctions_h
#define strFunctions_h

/* code */

#endif

colorTheme.h:

#ifndef colorTheme_h
#define colorTheme_h

#include <Arduino.h>

/* code */

#endif

All my .cpp files have just this at the beginning:

#include "[correspondent header file].h"

/* code */

PS: I omitted the code that weren't related to "file included", because I think it's not relevant to the problem, all functions have different names.

I can't get it to compile.

Any help would be appreciated. :slight_smile:

TFT_Objects.zip (627 KB)

Any help would be appreciated.

So would a zip file of all of your code, if you really expect help.

I'm sorry (again).

I've attached the zip with the files!

Your sketch references

#include <UTFT_Geometry.h>

which is not in the zip file.

Updated the zip and included the remaining necessary libraries.

Well, I unzipped your file, put the libraries in the libraries folder, put the sketch in the appropriate sketch folder, and compiled. I only got one error:

Binary sketch size: 44,476 bytes (of a 258,048 byte maximum)

After seeing your answer, instantly I thought about the IDE version.
I was using 1.6.6 (Hourly build / beta), after testing with 1.6.5 it just worked.

Thanks for the help! Next time I will try with other IDE too...

I was using 1.6.6 (Hourly build / beta)

Why? Are you a beta tester?

giova014:
Thanks for the help! Next time I will try with other IDE too...

I usually test with 1.0.6.

Why get the latest, greatest, bugs? It's not as if the more recent IDEs have a better video card driver on them.

PaulS:
Why? Are you a beta tester?

It's a habit of having "the latest", but obviously unnecessary, because it would solve no problems that I had and even create others (this case).
Something I will think thrice before upgrading...