title: How to access decision variables: OPL/Cplex && C++
body: <p>I am using OPL/Cplex libraries in my c++ code,</p>
  
  <p>In my file.mod I decalred this decision variable:
  dvar int+ x[nodes][nodes][1..nb_max][lambdas];</p>
  
  <p>Now I that Cplex solved the model I successfully recuperate the objective value as follows:</p>
  
  <pre><code>try {
       IloCplex cplex(env);
  
      cplex.setOut(env.getNullStream());
       IloOplErrorHandler handler(env,cout);
       IloOplModelSource modelSource(env, "file.mod");
      IloOplSettings settings(env,handler);
       IloOplModelDefinition def(modelSource,settings);
      IloOplModel opl(def,cplex);
       IloOplDataSource dataSource(env, "file2.dat");
      opl.addDataSource(dataSource);
       opl.generate();
      if ( cplex.solve() ) {
        cout&lt;&lt; opl.getCplex().getObjValue()&lt;&lt; endl;
                           }
       }
  </code></pre>
  
  <p>My question is how can I recuperate the multidimentional array "x"?
  I tried with</p>
  
  <p>IloIntVar  x = opl.getElement("x").asIntVar;
             IloIntVar xvar =x.get(0);//first item</p>
  
  <p>but the following errors occur!</p>
  
  <p>error: conversion from '' to non-scalar type 'IloIntVar' requested
  error: 'class IloIntVar' has no member named 'get'</p>
  
  <p>I am really a beginner in OPL,
  Thanks in advance!</p>