我在我的c ++项目中使用pic32设备。
编译时出现以下错误:
"C:\Program Files (x86)\Microchip\xc32\v1.30\bin\xc32-g++.exe"
-mprocessor=32MZ2048ECM144
-o dist/default/production/DF.X.production.elf
build/default/production/_ext/1323855441/newfile.o
H:\GUI\simulation\C-CODE\vsss\Debug\wavelet2d.lib
-Wl,--defsym=__MPLAB_BUILD=1\
,--script="H:\GUI\simulation\C-CODE\vsss\Debug\wavelet2d.lib"\
,-Map="dist/default/production/DF.X.production.map"
c:/program files (x86)/microchip/xc32/v1.30/bin/../lib/gcc/pic32mx/4.5.2/../../../../pic32mx/bin/ld.exe:H:\GUI\simulation\C-CODE\vsss\Debug\wavelet2d.lib:1:syntax error
collect2: ld returned 1
exit status
make[2]: *** [dist/default/production/DF.X.production.hex] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
make[2]: Leaving directory `C:/Users/sony/MPLABXProjects/DF.X'
make[1]: Leaving directory `C:/Users/sony/MPLABXProjects/DF.X'
BUILD FAILED (exit value 2, total time: 208ms)
代码:
#include <iostream>
#include <fstream>
#include <conio.h>
#include "F:\MTECH-PROJECT\simulation\C-CODE\wavelet-lib\wavelib\src\shared\wavelet2d.h"
#include <vector>
#include <string>
#include <cmath>
#include <math.h>
inline double round(double x){
return (floor(x+0.5));
}
using namespace std;
int main()
{
//cout << "Enter the name of signal file at the Prompt eg., signal.txt :" << endl;
char inp[200000]="H:\\GUI\\simulation\\C-CODE\\vsss\\signal.txt";//voltage
char inp1[200000]="H:\\GUI\\simulation\\C-CODE\\vsss\\vsag.txt";//voltage sag
//cin >> inp;
string nm="db10";
vector<double> sig;
vector<double> vsag;
ifstream sig_inp(inp);
if ( !sig_inp.good()){
//cout << "The File doesn’t exist"<< endl;
}
while (!sig_inp.eof()) {
double temp1;
sig_inp >> temp1;
sig.push_back(temp1);
}
sig.pop_back();
vector<double> original;
original = sig;
ifstream vsag_inp1(inp1);
if ( !vsag_inp1.good()){
//cout << "The File doesn’t exist"<< endl;
}
while (!vsag_inp1.eof()) {
double temp;
vsag_inp1 >> temp;
vsag.push_back(temp);
}
vsag.pop_back();
vector<double> original1;
original1 = vsag;
//cout << "Please Enter the Number of DWT Stages J :" << endl;
int J=6,s;
getch();
vector<double> dwt_output, flag;
// perform J-Level DWT
vector<int> length;
dwt_sym(vsag, J, nm, dwt_output,flag,length);
ofstream dwtout("C:\\Users\\sony\\Desktop\\PROJECT\\dwtout.txt",ios::out);
for (unsigned int i = 0; i < dwt_output.size(); i++){
dwtout << dwt_output[i] << endl;
}
//Perform J-Level IDWT
vector<double> output;
double q[1200],q1[1200];
idwt_sym(dwt_output, flag,nm,output,length);
ofstream sig2("G:\\GUI\\FILES\\recon.txt");
ofstream diff("G:\\GUI\\FILES\\diff.txt");
//cout <<" Recon signal size" << output.size() << endl;
s=original.size();
for (unsigned int i = 0; i < s; i++){
q[i]=original[i]- output[i];
sig2 << output[i] << endl;
diff <<original[i]- output[i] << endl;
}
double q2[1200],qs[1200];
ofstream diff1("G:\\GUI\\FILES\\diff1.txt");
for (unsigned int i = 0; i < s; i++){
qs[i]=original[i]- output[i];
//cout<<original[i]<<"\t"<<output[i]<<"\t"<<q[i]<<"\n";
diff1 << q[i]<<"\n";
}
for (unsigned int i = 0; i < s;i++){
q1[i]=abs(q[i]);
//cout<<q1[i];
q2[i]=round(q1[i]);
}
//cout<<"round"<<q[1]<<"\t"<<round(q1[1]);
int w;
w=255;
int j=1;
int t1;
while (j<w)
{
if ((q2[j]==0) && (q2[j+1]>1))
{
t1=j;
break;
}
j++;
}
int start_time;
start_time=j+1;
int t2;
while (j<w)
{
if ((q2[j]>0) && (q2[j+1]==0) && (q2[j+1]==0) && (q2[j+2]==0)) {
t2=j;
break;
}
j++;
}
int end_time;
end_time=j+1;
int p;
double max,q3[1200];
//p=start_time;
for (int i=0;i<s;i++)
{
q3[i]=original1[i];
}
max=original[0];
for (p=start_time;p<end_time;p++)
{
if (q3[p]>max)
max=q3[p];
}
double magnitude;
magnitude=abs(max);
getch();
cout<<"\n\n"<<"RESULTS OF ALGORITHM USING DISCRETE WAVELET TRANSFORM"<<"\n\n";
cout<<"*****************************************************"<<"\n\n";
cout<<"Input signal:230V 50Hz single phase AC"<<"\n\n";
cout<<"Voltage sag parameters"<<"\n\n";
cout<<"Start time(ms):"<<start_time<<"\n"<<"End time(ms):"<<end_time<<"\n"<<"Magnitude(V):"<<magnitude<<"\n";
//gnudwtplot(J);
getch();
return 0;
}