hai
i am working with a small project on files. the program is compiled but when i am excuting than i am getting linker error i.e

[Linker error] undefined reference to `__cpu_features_init'
ld returned 1 exit status

Regard's
balu

We can say nothing for sure if we can't see your code, but I can maybe use my physic powers to make a guess.

Couldn't it be that you try to access __cpu_features_init in a place where your program can't see it, or you've made a typo, or you just didn't declare it?

ok know this is the code:

MyClass.h

#ifndef MYCLASS_H
#define MYCLASS_H
class MYCLASS
{
      private:
            char *inputfname1,*inputfname2,*outputfname;
            double num,num1,x1,y1,x2,y2,x3,y3,m1,m2;
            int flag;
      public:
             MYCLASS();
             ~MYCLASS();
             bool getinputfile();
             bool getoutputfile();
             void processdata();
};
#endif

MyClass.cpp

#include<fstream>
#include <iostream>
#include<stdio.h>
#include "myclass.h"
using namespace std;

MYCLASS::MYCLASS()
{
                  num=num1=x1=y1=x2=y2=x3=y3=m1=m2=0.0;
                  flag=0;
                  inputfname1= new char[25];
                  inputfname2= new char[25];
                  outputfname= new char[25];
}
MYCLASS::~MYCLASS()
{
   delete []inputfname1;
   delete []inputfname2;
   delete []outputfname;

}
bool MYCLASS::getinputfile()
{
     cout << "\nENTER SOURCE FILE1 NAME:";
     gets(inputfname1);
     ifstream infile(inputfname1);
     if (!(infile.is_open()))
     {
               cerr << "Unable to open source file1" << endl;
               return 0;
     }
     cout << "\nENTER SOURCE FILE2 NAME:";
     gets(inputfname2);
     ifstream infile1(inputfname2);
     if (!(infile1.is_open()))
      {
         cerr << "Unable to open source file2" <<endl;
         return 0;
       }
     return getoutputfile();

}
bool MYCLASS:: getoutputfile()
{
     cout << "\nENTER TARGET FILE NAME:";
     gets(outputfname);
     ofstream outfile (outputfname);
     if (!(outfile.is_open()))
     {
        cout << "Unable to Create target file" <<endl;
        return 0;
     }
   processdata();
   return 1;
}
void MYCLASS::processdata()
{
    ofstream outfile (outputfname);
    ifstream infile1(inputfname2);
    ifstream infile(inputfname1);
    outfile<<"TIME"<<'\t'<<"TEMP"<<'\n';
    infile>>num;
    infile1>>num1;
    outfile<<num<<'\t'<<num1<<'\n';
    x1=num;
    y1=num1;
    infile>>num;
    infile1>>num1;
    x2=num;
    y2=num1;
    while(!infile.eof()||!infile1.eof())
    {

          infile>>num;
          infile1>>num1;
          x3=num;
          y3=num1;
         if( (y2-y1)!=0.0  &&  (x2-x1)!=0.0  &&  (y3-y2)!=0.0  &&  (x3-x2)!=0.0)
          {
                m1=(double)(y2-y1)*1.0/(x2-x1)*1.0;
                m2=(double)(y3-y2)*1.0/(x3-x2)*1.0;
                flag=1;
          }
          if(y2!=y1*1.5)
          {
                        outfile<<x2<<'\t'<<y2<<'\n';
                        x1=x2;
                        y1=y2;
                        infile>>num;
                        infile1>>num1;
                        x2=num;
                        y2=num1;
                        flag=0;
          }
          else if(  m1!=m2  &&  flag==1 )
          {
               outfile<<x2<<'\t'<<y2<<'\n';
               x1=x2;
               y1=y2;
               infile>>num;
               infile1>>num1;
               x2=num;
               y2=num1;
               flag=0;

          }
          else if(  m2!=m1*1.5  &&  flag==1  )
          {
               outfile<<x3<<'\t'<<y3<<'\n';
               x1=x3;
               y1=y3;
               infile>>num;
               infile1>>num1;
               x2=num;
               y2=num1;
               flag=0;
           }

    }
     infile.close();
     infile1.close();
     outfile.close();

}

main.cpp

#include <cstdlib>
#include <iostream>
#include "myclass.h"
using namespace std;

int main()
{
   MYCLASS mc;
   if(mc.getinputfile()==1)
   cout <<"Program is Success" <<endl;
   system("PAUSE");
   return EXIT_SUCCESS;
}

Edited 3 Years Ago by Reverend Jim: Fixed formatting

Ok, so this is not a code problem.
You probably have multiple versions of Dev-CPP (and/or MinGW) installed and that is causing the problem.

Here's how to fix it

Also next time, when posting code: USE CODE TAGS

This article has been dead for over six months. Start a new discussion instead.