Header File Problem
|
08.08.2015, 06:52
Beitrag #1
|
|||
|
|||
Header File Problem
Hello guys
![]() I want to create a new header with Wire.h header , but I have an error. If somebody could help me , please. Name of my new header is I2CH.h ,My code is the same as below : ------------------------------------------------------------------------------- //I2CH.h #ifndef I2CH_H #define I2CH_H #include "Arduino.h" #include "Wire.h" class I2CH { public: void I2CBegin(); }; #endif ---------------------------------------------------------------------------------- //I2CH.cpp #include "I2CH.h" void I2CH::I2CBegin() { Wire.begin(); // join i2c bus (address optional for master) } ---------------------------------------------------------------------------------------- //Main.ino #include <I2CH.h> #include <Wire.h> I2CH I2C; void setup() { I2C.I2CBegin(); } void loop() { } ---------------------------------------------------------------------------------------- //Compile error C:\Users\Leon\AppData\Local\Temp\build6400254520694862223.tmp\aa.cpp.o: In function `setup': C:\Program Files (x86)\Arduino/aa.ino:7: undefined reference to `I2CH::I2CBegin()' collect2.exe: error: ld returned 1 exit status. Error compiling. |
|||
08.08.2015, 08:55
Beitrag #2
|
|||
|
|||
RE: Header File Problem
Hi,
where did you put these files? Regards, Thorsten Falls ich mit einer Antwort helfen konnte, wuerde ich mich freuen, ein paar Fotos oder auch ein kleines Filmchen des zugehoerigen Projekts zu sehen. |
|||
08.08.2015, 09:21
Beitrag #3
|
|||
|
|||
RE: Header File Problem
It compiles without any errors when the folder for the .ccp and .h files is named "I2CH" under the libraries - folder.
One rule ist, that name of the class, foldername and filenames must be exactly the same (also upper-/lowercase of the names). Regards Nüchtern betrachtet...ist besoffen besser ![]() |
|||
08.08.2015, 10:10
Beitrag #4
|
|||
|
|||
RE: Header File Problem
Thanks to answer me, I've considered all these things and I put this header in file , the same name with class and in this direction: C:\Users\Leon\Documents\Arduino\libraries\I2CH
But I still have problem. Actually when I want to use I2C.I2CBegin(); in void setup , compiler has that error. Thanks again. |
|||
08.08.2015, 10:21
Beitrag #5
|
|||
|
|||
RE: Header File Problem
Have you restarted the IDE since putting the files into the libraries directory?
Falls ich mit einer Antwort helfen konnte, wuerde ich mich freuen, ein paar Fotos oder auch ein kleines Filmchen des zugehoerigen Projekts zu sehen. |
|||
08.08.2015, 11:18
Beitrag #6
|
|||
|
|||
RE: Header File Problem
yes I'vd done but nothing.
|
|||
08.08.2015, 12:31
(Dieser Beitrag wurde zuletzt bearbeitet: 08.08.2015 12:39 von rkuehle.)
Beitrag #7
|
|||
|
|||
RE: Header File Problem
Take a look at this:
All files - except the sketch - should be saved in the libraries\I2CH - folder The sketch: Code: #include <I2CH.h> Code: // File I2CH.h Code: //File I2CH.cpp Code: // File keywords.txt Regards Ricardo Nüchtern betrachtet...ist besoffen besser ![]() |
|||
08.08.2015, 13:50
Beitrag #8
|
|||
|
|||
RE: Header File Problem
Thank you all of you guys.
Finally I've got solved problem. Problem was extension of cpp file . It is I2CH.cpp .but I'd written I2CH.Cpp Thanks again ![]() ![]() ![]() ![]() |
|||
|
|
|
Möglicherweise verwandte Themen... | |||||
Thema: | Verfasser | Antworten: | Ansichten: | Letzter Beitrag | |
Problem mit der Textauswertung | Franz54 | 13 | 331 |
15.04.2018 18:17 Letzter Beitrag: Tommy56 |
|
Problem mit RIFD UID | ParadoxDev | 6 | 240 |
27.03.2018 12:04 Letzter Beitrag: ParadoxDev |
|
Sound File | BluPxl | 9 | 388 |
23.03.2018 15:21 Letzter Beitrag: Tommy56 |
|
Problem mit OLED 0.96" Display | torsten_156 | 5 | 1.720 |
07.03.2018 23:27 Letzter Beitrag: Tommy56 |
|
Ucglib Library Problem | Bully | 26 | 944 |
05.03.2018 18:47 Letzter Beitrag: Tommy56 |
|
RH_RF95.h: No such file or directory | n88 | 2 | 303 |
15.02.2018 08:49 Letzter Beitrag: Fips |
|
Problem mit Wire.available() abfrage | avoid | 1 | 334 |
11.01.2018 13:40 Letzter Beitrag: Tommy56 |
|
SerialComInstruments 4 Problem Darstellung | Nextero | 35 | 1.478 |
15.12.2017 18:51 Letzter Beitrag: ElEspanol |
|
Problem mit Nema17 und A4988 | Philthy | 6 | 472 |
08.12.2017 12:35 Letzter Beitrag: Tommy56 |
|
Arduino -> Controllino [Problem gelöst] | Cyrilsneer | 17 | 1.343 |
27.11.2017 18:49 Letzter Beitrag: Franz54 |
Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste