asking for kind help and support

Status
Not open for further replies.

ermias

New member
first I would like to thank you in advance for your kind and valuable help. Here is my question I am trying to use the library made by for wavelet transform applcation for viberation data to detect annomalies and fault more specifically for industrial bearing. But when I tried to compile the liberery for Teensy 3.6 using Arduino 1.8.5 I got an error as i mention below. all the liberery as well the implimenation files are made of C code what i mean using .c. anyone who can suggest me the solution? I guess the problem is with the linker and compiler.
// here is the sample code to test simple with simple imput data
void loop() {

Serial.begin(9600);
wave_object obj;
wt_object wt;
double *inp, *out, *diff;
int N, i, J;
char *name = "db4";
obj = wave_init(name);// Initialize the wavelet
N = 14; //Length of Signal
inp = (double*)malloc(sizeof(double)* N); //Input signal
out = (double*)malloc(sizeof(double)* N);
diff = (double*)malloc(sizeof(double)* N);
//wmean = mean(temp, N);
for (i = 0; i < N; ++i) {
inp = i;
Serial.println(inp);
}
J = 1; //Decomposition Levels
wt = wt_init(obj, "dwt", N, J);// Initialize the wavelet transform object
Serial.println(wt->siglength);
setDWTExtension(wt, "sym");// Options are "per" and "sym". Symmetric is the default option
setWTConv(wt, "direct");
dwt(wt, inp);// Perform DWT
//DWT output can be accessed using wt->output vector. Use wt_summary to find out how to extract appx and detail coefficients
for (i = 0; i < wt->outlength; ++i) {
Serial.println(wt->output);
}

idwt(wt, out);// Perform IDWT (if needed)
// Test Reconstruction
for (i = 0; i < wt->siglength; ++i) {
diff = out - inp;
}

Serial.println(absmax(diff, wt->siglength)); // If Reconstruction succeeded then the output should be a small value.
Serial.println("FIN");
Serial.flush();

}

double absmax(double *array, int N) {
double max;
int i;
max = 0.0;
for (i = 0; i < N; ++i) {
if (fabs(array) >= max) {
max = fabs(array);
}
}
return max;
}

// here are the Generated error when I tried to compiled
c:/program files (x86)/arduino/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7e-m/fpu\libc.a(lib_a-closer.o): In function `_close_r':

closer.c:(.text._close_r+0xc): undefined reference to `_close'

c:/program files (x86)/arduino/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7e-m/fpu\libc.a(lib_a-lseekr.o): In function `_lseek_r':

lseekr.c:(.text._lseek_r+0x12): undefined reference to `_lseek'

c:/program files (x86)/arduino/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7e-m/fpu\libc.a(lib_a-readr.o): In function `_read_r':

readr.c:(.text._read_r+0x12): undefined reference to `_read'

c:/program files (x86)/arduino/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7e-m/fpu\libc.a(lib_a-fstatr.o): In function `_fstat_r':

fstatr.c:(.text._fstat_r+0x10): undefined reference to `_fstat'

c:/program files (x86)/arduino/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/armv7e-m/fpu\libc.a(lib_a-isattyr.o): In function `_isatty_r':

isattyr.c:(.text._isatty_r+0xc): undefined reference to `_isatty'

collect2.exe: error: ld returned 1 exit status

Error compiling for board Teensy 3.6.
 
Last edited:
When I compile that code for T3.6, I do not get any of the errors you've listed. I get this lot:
Code:
sketch_dec03a: In function 'void loop()':
sketch_dec03a:5: error: 'wave_object' was not declared in this scope
   wave_object obj;

   ^

sketch_dec03a:6: error: 'wt_object' was not declared in this scope
   wt_object wt;

   ^

sketch_dec03a:9: warning: ISO C++ forbids converting a string constant to 'char*' 
   char *name = "db4";

                ^

sketch_dec03a:10: error: 'obj' was not declared in this scope
   obj = wave_init(name);// Initialize the wavelet

   ^

sketch_dec03a:10: error: 'wave_init' was not declared in this scope
   obj = wave_init(name);// Initialize the wavelet

                       ^

sketch_dec03a:21: error: 'wt' was not declared in this scope
   wt = wt_init(obj, "dwt", N, J);// Initialize the wavelet transform object

   ^

sketch_dec03a:21: error: 'wt_init' was not declared in this scope
   wt = wt_init(obj, "dwt", N, J);// Initialize the wavelet transform object

                                ^

sketch_dec03a:23: error: 'setDWTExtension' was not declared in this scope
   setDWTExtension(wt, "sym");// Options are "per" and "sym". Symmetric is the default option

                            ^

sketch_dec03a:24: error: 'setWTConv' was not declared in this scope
   setWTConv(wt, "direct");

                         ^

sketch_dec03a:25: error: 'dwt' was not declared in this scope
   dwt(wt, inp);// Perform DWT

              ^

sketch_dec03a:31: error: 'idwt' was not declared in this scope
   idwt(wt, out);// Perform IDWT (if needed)

               ^

'wave_object' was not declared in this scope

Do not see any #include in your code
There's no setup function either.

Pete
 
When I compile that code for T3.6, I do not get any of the errors you've listed. I get this lot:
Code:
sketch_dec03a: In function 'void loop()':
sketch_dec03a:5: error: 'wave_object' was not declared in this scope
   wave_object obj;

   ^

sketch_dec03a:6: error: 'wt_object' was not declared in this scope
   wt_object wt;

   ^

sketch_dec03a:9: warning: ISO C++ forbids converting a string constant to 'char*' 
   char *name = "db4";

                ^

sketch_dec03a:10: error: 'obj' was not declared in this scope
   obj = wave_init(name);// Initialize the wavelet

   ^

sketch_dec03a:10: error: 'wave_init' was not declared in this scope
   obj = wave_init(name);// Initialize the wavelet

                       ^

sketch_dec03a:21: error: 'wt' was not declared in this scope
   wt = wt_init(obj, "dwt", N, J);// Initialize the wavelet transform object

   ^

sketch_dec03a:21: error: 'wt_init' was not declared in this scope
   wt = wt_init(obj, "dwt", N, J);// Initialize the wavelet transform object

                                ^

sketch_dec03a:23: error: 'setDWTExtension' was not declared in this scope
   setDWTExtension(wt, "sym");// Options are "per" and "sym". Symmetric is the default option

                            ^

sketch_dec03a:24: error: 'setWTConv' was not declared in this scope
   setWTConv(wt, "direct");

                         ^

sketch_dec03a:25: error: 'dwt' was not declared in this scope
   dwt(wt, inp);// Perform DWT

              ^

sketch_dec03a:31: error: 'idwt' was not declared in this scope
   idwt(wt, out);// Perform IDWT (if needed)

               ^

'wave_object' was not declared in this scope


There's no setup function either.

Pete

Dear Pete I would like to appreciate for your queeck response. In the full program I included the setup function and the liberery function for detail information here is the full skech program

#include <string.h>
#include <math.h>
#include <Arduino.h>
#include "wavelib.h"



void setup()
{
pinMode(ledpin,OUTPUT);
}


void loop() {

Serial.begin(9600);
wave_object obj;
wt_object wt;
double *inp, *out, *diff;
int N, i, J;
char *name = "db4";
obj = wave_init(name);// Initialize the wavelet
N = 14; //Length of Signal
inp = (double*)malloc(sizeof(double)* N); //Input signal
out = (double*)malloc(sizeof(double)* N);
diff = (double*)malloc(sizeof(double)* N);
//wmean = mean(temp, N);
for (i = 0; i < N; ++i) {
inp = i;
Serial.println(inp);
}
J = 1; //Decomposition Levels
wt = wt_init(obj, "dwt", N, J);// Initialize the wavelet transform object
Serial.println(wt->siglength);
setDWTExtension(wt, "sym");// Options are "per" and "sym". Symmetric is the default option
setWTConv(wt, "direct");
dwt(wt, inp);// Perform DWT
//DWT output can be accessed using wt->output vector. Use wt_summary to find out how to extract appx and detail coefficients
for (i = 0; i < wt->outlength; ++i) {
Serial.println(wt->output);
}

idwt(wt, out);// Perform IDWT (if needed)
// Test Reconstruction
for (i = 0; i < wt->siglength; ++i) {
diff = out - inp;
}

Serial.println(absmax(diff, wt->siglength)); // If Reconstruction succeeded then the output should be a small value.
Serial.println("FIN");
Serial.flush();

}

double absmax(double *array, int N) {
double max;
int i;
max = 0.0;
for (i = 0; i < N; ++i) {
if (fabs(array) >= max) {
max = fabs(array);
}
}
return max;
}
 
I include the library function in the full sketch and I define setup function default
#include <string.h>
#include <math.h>
#include <Arduino.h>
#include "wavelib.h"



void setup()
{
pinMode(ledpin,OUTPUT);
}


void loop() {

Serial.begin(9600);
wave_object obj;
wt_object wt;
double *inp, *out, *diff;
int N, i, J;
char *name = "db4";
obj = wave_init(name);// Initialize the wavelet
N = 14; //Length of Signal
inp = (double*)malloc(sizeof(double)* N); //Input signal
out = (double*)malloc(sizeof(double)* N);
diff = (double*)malloc(sizeof(double)* N);
//wmean = mean(temp, N);
for (i = 0; i < N; ++i) {
inp = i;
Serial.println(inp);
}
J = 1; //Decomposition Levels
wt = wt_init(obj, "dwt", N, J);// Initialize the wavelet transform object
Serial.println(wt->siglength);
setDWTExtension(wt, "sym");// Options are "per" and "sym". Symmetric is the default option
setWTConv(wt, "direct");
dwt(wt, inp);// Perform DWT
//DWT output can be accessed using wt->output vector. Use wt_summary to find out how to extract appx and detail coefficients
for (i = 0; i < wt->outlength; ++i) {
Serial.println(wt->output);
}

idwt(wt, out);// Perform IDWT (if needed)
// Test Reconstruction
for (i = 0; i < wt->siglength; ++i) {
diff = out - inp;
}

Serial.println(absmax(diff, wt->siglength)); // If Reconstruction succeeded then the output should be a small value.
Serial.println("FIN");
Serial.flush();

}

double absmax(double *array, int N) {
double max;
int i;
max = 0.0;
for (i = 0; i < N; ++i) {
if (fabs(array) >= max) {
max = fabs(array);
}
}
return max;
}
 
Status
Not open for further replies.
Back
Top