Operator [] in a vector of ofPixels

I’m making a “vector< ofPixels> pixels”;

then I need to access at the single pixel one by one, so I write

for(int i = 0; i < pixels.size(); i++) {
 for(int j = 0; j < pixels[i].size(); j++) {
  cout << pixels[i][j] << endl; //////////////// here, the [] operator seems not working
 }
}

console gives me this :

sharedlibrary apply-load-rules all
Warning: the current language does not match this frame.
Current language:  auto; currently c++

So what’s the right way to write the code?

Are you allocating the ofPixels inside of your std::vector<ofPixels> before you iterate through?

yes, the vector is filled with images loaded in the drag event

Hmmm … that is an odd error.

One thing that might be happening is your console may be interpreting the pixel values as characters rather than giving you the integer values.

If you change

std::cout << pixels[i][j] << std::endl;

to

std::cout << (int)pixels[i][j] << std::endl;

Does anything change?

And, is your program actually crashing or just giving an error? And are you sure that it is happening right at the pixels[i][j] line?