add all source code in a project

Hi, I'm a new user, I have ardunio uno and adafruit 2.8" LCD--ILI9341 for study, I download the adafruit ILI9341 master library and saved in my fold. open a sample graphicstest, it can compile/upload to my UNO board and run. but for me, I want to open all source code to look, because my goal is transfer this code to my own project that is based on MSP430 microprocessor.
when I double click this project, the Arduino IDE open, and one file graphicstest show up, there are 3 Head files included, PSI.h, Adafruit_GFX.h and Adafruit_ILI9341.h. after I try to add the head file Adafruit_ILI9341.h by click the Add File under Sketch menu, and compile this project again, lots of error coming.
my question:

  1. why there are errors after add this file ?
  2. how I can add the files that include all functions in this project? and where I can find these files.
  3. is it possible to run the project by Step or Break Point ?

thanks a lot

Libraries are supposed to be in self named folders in the users arduino/libaries folder. Not in the same folder as the sketch.

See:

https://learn.sparkfun.com/tutorials/installing-an-arduino-library

https://arduino-info.wikispaces.com/Arduino-Libraries
.

aarg:
Libraries are supposed to be in self named folders in the users arduino/libaries folder. Not in the same folder as the sketch.

However if you WANT to put all the files in the project directory that should work fine. But you need to change
#include <library.h> to #include "library.h"

If you want to put the library files in another non-standard directory you will need
#include "full/path/to/library.h" AND also #include all the files in the library (not just the .h file) so that the compiler can find them.

While both of these strategies should work they can make managing your code very tedious.

...R

thank you everybody, still not understand what you means, the samples project at : C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest
I add the head file "Adafruit_ILI9341.h" which is C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master,

then compile the project, lots of error come, could you tell me why ?

thank you

then compile the project, lots of error come, could you tell me why ?

Read the answers that you have been given. They tell you what you are doing wrong.

attached the picture which is original project without any file added, it compile passed, no any problem

then I added one head file, compile again, many error come as follow? my question: why after added one file. some error come?

Arduino: 1.6.7 (Windows 10), Board: "Arduino/Genuino Uno"

sketch\graphicstest.ino.cpp.o: In function `__static_initialization_and_destruction_0':

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:26: undefined reference to `Adafruit_ILI9341::Adafruit_ILI9341(signed char, signed char, signed char)'

sketch\graphicstest.ino.cpp.o: In function `testFillScreen()':

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:112: undefined reference to `Adafruit_ILI9341::fillScreen(unsigned int)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:113: undefined reference to `Adafruit_ILI9341::fillScreen(unsigned int)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:114: undefined reference to `Adafruit_ILI9341::fillScreen(unsigned int)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:115: undefined reference to `Adafruit_ILI9341::fillScreen(unsigned int)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:116: undefined reference to `Adafruit_ILI9341::fillScreen(unsigned int)'

sketch\graphicstest.ino.cpp.o:C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:121: more undefined references to `Adafruit_ILI9341::fillScreen(unsigned int)' follow

sketch\graphicstest.ino.cpp.o: In function `loop':

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:104: undefined reference to `Adafruit_ILI9341::setRotation(unsigned char)'

sketch\graphicstest.ino.cpp.o: In function `testLines(unsigned int)':

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:153: undefined reference to `Adafruit_ILI9341::fillScreen(unsigned int)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:163: undefined reference to `Adafruit_ILI9341::fillScreen(unsigned int)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:174: undefined reference to `Adafruit_ILI9341::fillScreen(unsigned int)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:185: undefined reference to `Adafruit_ILI9341::fillScreen(unsigned int)'

sketch\graphicstest.ino.cpp.o: In function `testRects(unsigned int)':

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:216: undefined reference to `Adafruit_ILI9341::fillScreen(unsigned int)'

sketch\graphicstest.ino.cpp.o:C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:251: more undefined references to `Adafruit_ILI9341::fillScreen(unsigned int)' follow

sketch\graphicstest.ino.cpp.o: In function `testTriangles()':

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:293: undefined reference to `Adafruit_ILI9341::color565(unsigned char, unsigned char, unsigned char)'

sketch\graphicstest.ino.cpp.o: In function `testFilledTriangles()':

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:304: undefined reference to `Adafruit_ILI9341::fillScreen(unsigned int)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:309: undefined reference to `Adafruit_ILI9341::color565(unsigned char, unsigned char, unsigned char)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:312: undefined reference to `Adafruit_ILI9341::color565(unsigned char, unsigned char, unsigned char)'

sketch\graphicstest.ino.cpp.o: In function `testRoundRects()':

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:324: undefined reference to `Adafruit_ILI9341::fillScreen(unsigned int)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:329: undefined reference to `Adafruit_ILI9341::color565(unsigned char, unsigned char, unsigned char)'

sketch\graphicstest.ino.cpp.o: In function `testFilledRoundRects()':

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:341: undefined reference to `Adafruit_ILI9341::fillScreen(unsigned int)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:345: undefined reference to `Adafruit_ILI9341::color565(unsigned char, unsigned char, unsigned char)'

sketch\graphicstest.ino.cpp.o: In function `testFastLines(unsigned int, unsigned int)':

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:202: undefined reference to `Adafruit_ILI9341::fillScreen(unsigned int)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:204: undefined reference to `Adafruit_ILI9341::drawFastHLine(int, int, int, unsigned int)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:205: undefined reference to `Adafruit_ILI9341::drawFastVLine(int, int, int, unsigned int)'

sketch\graphicstest.ino.cpp.o: In function `testFilledRects(unsigned int, unsigned int)':

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:233: undefined reference to `Adafruit_ILI9341::fillScreen(unsigned int)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:238: undefined reference to `Adafruit_ILI9341::fillRect(int, int, int, int, unsigned int)'

sketch\graphicstest.ino.cpp.o: In function `setup':

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:34: undefined reference to `Adafruit_ILI9341::begin()'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:37: undefined reference to `Adafruit_ILI9341::readcommand8(unsigned char, unsigned char)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:39: undefined reference to `Adafruit_ILI9341::readcommand8(unsigned char, unsigned char)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:41: undefined reference to `Adafruit_ILI9341::readcommand8(unsigned char, unsigned char)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:43: undefined reference to `Adafruit_ILI9341::readcommand8(unsigned char, unsigned char)'

C:\JimWang\ElectronicsProject\Adafruit_ILI9341-master\examples\graphicstest/graphicstest.ino:45: undefined reference to `Adafruit_ILI9341::readcommand8(unsigned char, unsigned char)'

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

Do you have the .cpp files to go with those headers? In the folders with the headers?

no any .cpp file in this fold, this is sample that I download and saved in my fold, I did not change anything

Stop posting pictures of the code and post the whole thing then we can try it ourselves. Also give a link to any libraries you use. Post in code rage, the </> icon.

You are not installing the libraries correctly, you were shown a link telling you how to do it.

Grumpy_Mike:
Stop posting pictures of the code and post the whole thing then we can try it ourselves. Also give a link to any libraries you use. Post in code rage, the </> icon.

You are not installing the libraries correctly, you were shown a link telling you how to do it.

sorry, I just use Arduino for 2 days, do not know how to properly ask the question.

could you understand my question?

Read the how to use this forum sticky post.
Yes I understand your question the problem is that you do not understand our answers.
You have been told many times to install the libraries correctly.

Grumpy_Mike:
Read the how to use this forum sticky post.
Yes I understand your question the problem is that you do not understand our answers.
You have been told many times to install the libraries correctly.

Grumpy_Mike:
Read the how to use this forum sticky post.
Yes I understand your question the problem is that you do not understand our answers.
You have been told many times to install the libraries correctly.

sure, I don't understand. but when I open this project, compile it and upload to my UNO board without any problem, is it means the Library already properly installed?

jimwang90:
no any .cpp file in this fold, this is sample that I download and saved in my fold, I did not change anything

Without the .cpp files, the definitions of those functions are missing. That's exactly the error you are getting.

Delta_G:
Without the .cpp files, the definitions of those functions are missing. That's exactly the error you are getting.

yes, but when I first open this project, only one file opened, compile it and upload to my UNO board without any problem, it is also no .cpp file?

That's a .ino file and it has definitions for all the functions that are declared in it. The .h files you are trying to include have function declarations, but not the definitions to go with them. Those definitions are in the .cpp files that are supposed to go with the .h files.

Delta_G:
That's a .ino file and it has definitions for all the functions that are declared in it. The .h files you are trying to include have function declarations, but not the definitions to go with them. Those definitions are in the .cpp files that are supposed to go with the .h files.

yes, you are correct, when I click the .ino file, I call it project file, the Arduino IDE open, which is can compile and upload. but my target is that transfer and modify all the source code for my other application, so I have to find all the Functions source code.

When you downloaded the library from wherever you downloaded it from, there was a .h file and a .cpp file (and maybe others). You need those to be together wherever you have them installed.

@jimwang90, We are now on page 2 and you have still not provided any hard information to allow people to help you - in spite of several requests for you to do so.

Post your code.
Post a diagram showing exactly how all your relevant files and directories are organized.

Saying "then I added one head file, compile again," (from Reply #7) is about as useful as telling the garage mechanic that your car won't work and you have your shopping bags in the trunk.

...R