Hello!
I have made a PDUDecode library for Arduino, but I have some errors and I do not know why? Can somebody look at the library and tell me what is the problem?
PDUDecode.cpp (3.4 KB)
PDUDecode.h (320 Bytes)
Hello!
I have made a PDUDecode library for Arduino, but I have some errors and I do not know why? Can somebody look at the library and tell me what is the problem?
PDUDecode.cpp (3.4 KB)
PDUDecode.h (320 Bytes)
Only your ino file has prototypes generated, add the code be low to your header file or the start of the cpp file
int hexToDec(String hexString);
int asciiToInt(int ascii);
String nrSender(String nr, int lungime_nr_sender);
String pduToText(String hex);
After that, no errors. If you get some more, they are in your sketch that isn't available.
Where is the sketch that uses this library? What are the errors?
DO N OT START ANOTHER THREAD ON THE SAME TOPIC!
Thak you pYro_65 . It is working.
Now I have another error.
This is the ino
#include <PDUDecode.h>
void setup() {
String text, nr_sender;
PDUDecode("sdas", text, nr_sender);
}
void loop() {
// put your main code here, to run repeatedly:
}
And this is the error
sketch_mar16a.cpp.o: In function `setup':
F:\arduino-1.5.4/sketch_mar16a.ino:5: undefined reference to `PDUDecode::PDUDecode(String, String, String)'
String text, nr_sender;
Uninitialized local variables.
PDUDecode("sdas", text, nr_sender);
Why are you passing crap to this function?
#include <PDUDecode.h>
Why are you using <>?
It fixed it. I have put PDUDecode:: in library
Its nothing to do with the sketch, its fine.
Didn't see your class:
class PDUDecode
{
public:
PDUDecode(String hex, String text, String nr_sender);
void nrSender(String number, int lungime_nr_sender);
int hexToDec(String hexString);
int asciiToInt(int ascii);
String pduToText(String hex);
};
Remove the changes I gave you, they aren't for this problem.
in the cpp file, the functions must use the class name, otherwise they are in the global namespace, not the class.
void PDUDecode::PDUDecode(String data, String &text, String &nr_sender)
{
Also notice the strings passed by reference. The class declaration in the header must match. And constructors have no return type.
nr_sender is declared void, your cpp has String,
lots of errors to fix. Read them, they contain the information you need to fix the problem.
It's done. I fixed all errors. Thank you!