# Undeclared identifier and expected unqualified-id

**URL:** <https://root-forum.cern.ch/t/undeclared-identifier-and-expected-unqualified-id/27501>\
**Category:** General Chat\
**Created:** [January 9, 2018, 8:06pm UTC](https://root-forum.cern.ch/t/undeclared-identifier-and-expected-unqualified-id/27501 "2018-01-09T20:06:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbmagallanes](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jbmagallanes/32/20291_2.png) [@jbmagallanes](https://root-forum.cern.ch/u/jbmagallanes)\
**Post date:** [January 9, 2018, 8:06pm UTC](https://root-forum.cern.ch/t/undeclared-identifier-and-expected-unqualified-id/27501/1 "2018-01-09T20:06:18Z")

</div>

I got this error:

```auto
//=======
In file included from input_line_100:1:
/home/jaybee/JaybeeCodes/Example.C:23:30: error: use of undeclared identifier
      'amp'
   ROOT::Math::Functor1D wf(&amp;f);
                             ^
/home/jaybee/JaybeeCodes/Example.C:56:28: error: use of undeclared identifier
      'amp'
   ROOT::Math::Functor wf(&amp;f2,2);
                           ^
/home/jaybee/JaybeeCodes/Example.C:93:1: error: expected unqualified-id
</cmath>
^
//=======

```

when I ran this program:

```auto
//=======
#include "Math/Integrator.h"
#include "Math/IntegratorMultiDim.h"
#include "Math/AllIntegrationTypes.h"
#include "Math/Functor.h"
#include "Math/GaussIntegrator.h"
 
#include <cmath>
 
const double ERRORLIMIT = 1E-3;
 
double f(double x) { 
   return x; 
} 
double f2(const double * x) { 
   return x[0] + x[1]; 
} 
 
int testIntegration1D() { 
 
   const double RESULT = 0.5;
   int status = 0;
 
   ROOT::Math::Functor1D wf(&amp;f);
   ROOT::Math::Integrator ig(ROOT::Math::IntegrationOneDim::kADAPTIVESINGULAR); 
   ig.SetFunction(wf);
   double val = ig.Integral(0,1);
   std::cout << "integral result is " << val << std::endl;
   status += std::fabs(val-RESULT) > ERRORLIMIT;
 
   ROOT::Math::Integrator ig2(ROOT::Math::IntegrationOneDim::kNONADAPTIVE); 
   ig2.SetFunction(wf);
   val = ig2.Integral(0,1);
   std::cout << "integral result is " << val << std::endl;
   status += std::fabs(val-RESULT) > ERRORLIMIT;
 
   ROOT::Math::Integrator ig3(wf, ROOT::Math::IntegrationOneDim::kADAPTIVE); 
   val = ig3.Integral(0,1);
   std::cout << "integral result is " << val << std::endl;
   status += std::fabs(val-RESULT) > ERRORLIMIT;
 
   //ROOT::Math::GaussIntegrator ig4;
   ROOT::Math::Integrator ig4(ROOT::Math::IntegrationOneDim::kGAUSS); 
   ig4.SetFunction(wf);
   val = ig4.Integral(0,1);
   std::cout << "integral result is " << val << std::endl;
   status += std::fabs(val-RESULT) > ERRORLIMIT;
 
   return status;
}
 
int testIntegrationMultiDim() { 
 
   const double RESULT = 1.0;
   int status = 0;
 
   ROOT::Math::Functor wf(&amp;f2,2);
   double a[2] = {0,0};
   double b[2] = {1,1};
 
   ROOT::Math::IntegratorMultiDim ig(ROOT::Math::IntegrationMultiDim::kADAPTIVE); 
   ig.SetFunction(wf);
   double val = ig.Integral(a,b);
   std::cout << "integral result is " << val << std::endl;
   status += std::fabs(val-RESULT) > ERRORLIMIT;
 
   ROOT::Math::IntegratorMultiDim ig2(ROOT::Math::IntegrationMultiDim::kVEGAS); 
   ig2.SetFunction(wf);
   val = ig2.Integral(a,b);
   std::cout << "integral result is " << val << std::endl;
   status += std::fabs(val-RESULT) > ERRORLIMIT;
 
   ROOT::Math::IntegratorMultiDim ig3(wf,ROOT::Math::IntegrationMultiDim::kPLAIN); 
   val = ig3.Integral(a,b);
   std::cout << "integral result is " << val << std::endl;
   status += std::fabs(val-RESULT) > ERRORLIMIT;
 
   ROOT::Math::IntegratorMultiDim ig4(wf,ROOT::Math::IntegrationMultiDim::kMISER); 
   val = ig4.Integral(a,b);
   std::cout << "integral result is " << val << std::endl;
   status += std::fabs(val-RESULT) > ERRORLIMIT;
 
   return status;
}
 
int main() { 
   int status = 0;
 
   status += testIntegration1D();
   status += testIntegrationMultiDim();
 
   return status;
}
</cmath>
//=======

```

want some help 🙂 thanks…  
i am new with ROOT programming, though…

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [January 9, 2018, 8:19pm UTC](https://root-forum.cern.ch/t/undeclared-identifier-and-expected-unqualified-id/27501/2 "2018-01-09T20:19:21Z")

</div>

[List of XML and HTML character entity references](https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references)

---

<div class="post-metadata">

**Author:** ![behrenhoff](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/behrenhoff/32/12285_2.png) [@behrenhoff](https://root-forum.cern.ch/u/behrenhoff)\
**Post date:** [January 9, 2018, 8:19pm UTC](https://root-forum.cern.ch/t/undeclared-identifier-and-expected-unqualified-id/27501/3 "2018-01-09T20:19:50Z")

</div>

Where did you copy the code from? `&amp;` is the HTML escape for the ampersand. Just replace all `&amp;` in your code with `&`.

---

<div class="post-metadata">

**Author:** ![jbmagallanes](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jbmagallanes/32/20291_2.png) [@jbmagallanes](https://root-forum.cern.ch/u/jbmagallanes)\
**Post date:** [January 9, 2018, 8:55pm UTC](https://root-forum.cern.ch/t/undeclared-identifier-and-expected-unqualified-id/27501/4 "2018-01-09T20:55:48Z")

</div>

I got it from here: [https://root.cern.ch/function-integration](https://root.cern.ch/function-integration)  
I am slowly exploring ROOT 🙂

Thanks,  
Jaybee

---

<div class="post-metadata">

**Author:** ![jbmagallanes](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jbmagallanes/32/20291_2.png) [@jbmagallanes](https://root-forum.cern.ch/u/jbmagallanes)\
**Post date:** [January 9, 2018, 9:02pm UTC](https://root-forum.cern.ch/t/undeclared-identifier-and-expected-unqualified-id/27501/5 "2018-01-09T21:02:57Z")

</div>

this is now the error:

//=======  
In file included from input\_line\_110:1:  
/home/jaybee/JaybeeCodes/Example.C:26:30: error: expected expression  
ROOT::Math::Functor1D wf(&;f);  
^  
/home/jaybee/JaybeeCodes/Example.C:59:28: error: expected expression  
ROOT::Math::Functor wf(&;f2,2);  
^  
/home/jaybee/JaybeeCodes/Example.C:97:1: error: expected unqualified-id  
  
^  
//=======

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [January 9, 2018, 9:24pm UTC](https://root-forum.cern.ch/t/undeclared-identifier-and-expected-unqualified-id/27501/6 "2018-01-09T21:24:17Z")

</div>

[&amp;](https://encrypted.google.com/search?hl=en&q=%22%26amp%3B%22)
