Warning about ofImage

I’m using Qt Creator on debian and i got this warning

ofImage img;

void ofApp::setup(){
	img.allocate(ofGetWidth(), ofGetHeight(), OF_IMAGE_GRAYSCALE);	
}

warning: instantiation of function 'ofImage_::allocate' required here, but no definition is available

i tried to look around but no solution i could found

I’m getting the same with .grabScreen(), .getPixels(), .load() and other methods related to ofImage. Would be great to know how to get rid of those warnings. Maybe the latest version of oF?

i think this style of forward declaration for templates:

should fix this errors in other classes

Hi, I tried:

  • adding those six lines to ofImage.h
  • adding them to ofImage.cpp
  • adding them to my own file where I use ofImage
  • adding the 3 Ref types which are missing after ofImage.h:653 (for Image instead of Pixels)

but none of these changes removed the warnings. Such warnings are also shown in ofImage.cpp, for example in line 41:

switch(pix.getNumChannels()) {

Mmm… maybe I should run Clean after the change? Should one of these approaches work?

it should go in the .h file after the declaration of the ofImage class and it’s methods. but it might be that the problem is something else