Hi,
I have some simple code using vectors that works just fine when I compile it with gcc/g++, but gives me an error in ROOT…
#include
#include
using namespace std;
void vectorTest(){
double ** returnArray;
returnArray = new double*[3];
for(int i = 0; i < 3; i++){
returnArray[i] = new double[2];
}
vector<double> sendVector;
sendVector.push_back(returnArray);
}
In ROOT:
root [0] .L vectorTest.C
root [1] vectorTest()
Error: Can’t call vector::push_back(returnArray) in current scope FILE:vectorTest.C LINE:13
Possible candidates are…
filename line:size busy function type and name (in vector)
_vector.h 116:9 0 public: void push_back(double* *const& x);
Error: Symbol sendVector is not defined in current scope FILE:vectorTest.C LINE:13
Error: Failed to evaluate sendVector.push_back(returnArray)Possible candidates are…
filename line:size busy function type and name
*** Interpreter error recovered ***
Meanwhile this exact same code (just with int main instead of void vectorTest and a return statement) compiles with g++ and runs without error.\
Thanks for your help,
Mikhail