Не мог скомпилировать Код C++

Каждый раз, когда я пытаюсь скомпилировать файл C++ с IOStream, я получаю эту ошибку.. Я попытался переустановить GCC G ++ (и 4.6 и 4.9) И cpp.. Это не помогло (или возможно я не сделал этого правильный путь). Как я фиксирую эту ошибку

In file included from /usr/include/c++/4.9/bits/localefwd.h:40:0,
             from /usr/include/c++/4.9/ios:41,
             from /usr/include/c++/4.9/ostream:38,
             from /usr/include/c++/4.9/iostream:39,
             from Integration_Any.cpp:1:
/usr/include/x86_64-linux-gnu/c++/4.9/bits/c++locale.h:52:23: error:‘uselocale’was         not declared in this scope
   extern "C" __typeof(uselocale) __uselocale;
                   ^
/usr/include/x86_64-linux-gnu/c++/4.9/bits/c++locale.h:52:45: error: invalid type in    declaration before ‘;’ token
   extern "C" __typeof(uselocale) __uselocale;
                                         ^
/usr/include/x86_64-linux-gnu/c++/4.9/bits/c++locale.h: In function ‘int     std::__convert_from_v(__locale_struct* const&, char*, int, const char*, ...)’:       /usr/include/x86_64-linux-gnu/c++/4.9/bits/c++locale.h:75:53: error:     ‘__gnu_cxx::__uselocale’ cannot be used as a function
     __c_locale __old = __gnu_cxx::__uselocale(__cloc);
                                                 ^
/usr/include/x86_64-linux-gnu/c++/4.9/bits/c++locale.h:100:33: error:     ‘__gnu_cxx::__uselocale’ cannot be used as a function
     __gnu_cxx::__uselocale(__old);
                             ^

Код является MPI

#include <iostream>
#include <math.h>
#include <stdlib.h>
#include "/home/pnpninja/PC/Monte Carlo/prng_engine.hpp"
#include "mpi.h"
#define sitmo_rand_max 4294967295
using namespace std;

int main(int argc,char* argv[])
{
//Initialization of variables
  int numprocs,myid,rc;
  double     iterations,eachintegration,integrationsum,pi,start,total_time,actualsum,llimit,rlimit,eac    hllimit,eachrlimit,coefficients[26],highest_coefficient;
    //Initialization on MPI Variables
  MPI_Init(&argc,&argv);
  MPI_Status status;
  MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
  MPI_Comm_rank(MPI_COMM_WORLD,&myid);
  //Get number of iterations in MASTER Process / Process 0
  if(myid == 0)
  {
      cout<<"Enter the highest coeffecient (highest is 25): ";
      cin>>highest_coefficient;
      for(int temp=highest_coefficient;temp>=0;temp--)
      {
        printf("Enter the coefficient of degree %d : ",temp);
        cin>>coefficients[temp];
      }
      cout<<"Enter the lower limit : ";
      cin>>llimit;
      cout<<"Enter the upper limit : ";
      cin>>rlimit;
      cout<<"Enter the number of iterations : ";
      cin>>iterations;
      start = MPI_Wtime();
  }
  //Broadcast it to all other processes
  MPI_Bcast(&highest_coefficient,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
    MPI_Bcast(coefficients,26,MPI_DOUBLE,0,MPI_COMM_WORLD);
  MPI_Bcast(&llimit,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
  MPI_Bcast(&rlimit,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
  MPI_Bcast(&iterations,1,MPI_DOUBLE,0,MPI_COMM_WORLD);
  //Parallel Random Generator with seed as Process ID
  sitmo::prng_engine eng(MPI_Wtime());
  eachintegration=0;
  eachllimit = llimit+(((rlimit-llimit)/numprocs)*myid);
  eachrlimit = llimit+(((rlimit-llimit)/numprocs)*(myid+1));
  for(int a=1;a<=iterations/numprocs;a++)
  {
    double point = eachllimit + ((double(eng())/(double(sitmo_rand_max)))*(eachrlimit-    eachllimit));
    for(int b=0;b<=highest_coefficient;b++)
    {
      eachintegration+=(coefficients[b]*(pow(point,b)));
    }
  }
  rc = MPI_Reduce(&eachintegration,&integrationsum,1, MPI_DOUBLE, MPI_SUM,0,     MPI_COMM_WORLD);
  if(myid == 0)
  {

    total_time = MPI_Wtime() - start;
    cout<<"\nThe integration by Monte Carlo method is :    "<<((integrationsum/iterations)*    (pow(rlimit-llimit,1)));
    actualsum=0;
    for(int c=0;c<=highest_coefficient;c++)
    {
      actualsum+=(coefficients[c]*((pow(rlimit,c+1))-(pow(llimit,c+1)))/(double(c+1)));
    }
    cout<<"\nThe error is : "<<((integrationsum/iterations)*(pow(rlimit-llimit,1)))-    actualsum;
cout<<"\nThe time taken is : "<<total_time<<"\n";
  }
      MPI_Finalize();
}

управляйте для компиляции

mpic++ Int_Any Integration_Any.cpp -lm

Даже простое Привет Мировая компиляция привычки программы, поскольку это дает мне эту ошибку

1
задан 12 November 2014 в 21:38

0 ответов

Другие вопросы по тегам:

Похожие вопросы: