I have an application (séquenceur.ino) that uses UTFT and UTouch libraries.
For this application, I have written a library (ChPComp) that is also using UTFT and UTouch. So I have declared in the file ChPComp.h the variables myGLCD and myTouch :
This is the only place where these variables are declared. They are used both in sequence.ino and ChPComp.cpp.
When I compile the application, I have the following error :
ChPComp\ChPComp.cpp.o:(.bss.myGLCD+0x0): multiple definition of `myGLCD'
Sequenceur.cpp.o:(.bss.myGLCD+0x0): first defined here
c:/documents and settings/pierre/mes documents/mes téléchargements/arduino-1.5.2/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions
ChPComp\ChPComp.cpp.o:(.bss.myTouch+0x0): multiple definition of `myTouch'
Sequenceur.cpp.o:(.bss.myTouch+0x0): first defined here
So I have declared in the file ChPComp.h the variables myGLCD and myTouch :
The question, of course, is where in that file the variables are defined. And, also, whether the file includes proper include guards to prevent multiple inclusion.
So, how to solve this problem ?
Write the code correctly. If you need help with that, you need to post the code.
I was going to say something like "Here is the start of the answer...", but majenko already provided the answer, so I'll resist the temptation to post a smart ass answer.