Toribash
Need to save this

DArray.h

This (http://cpp.sh/2ks6b) reproduces the error I was getting and discussed with Fear a little on IRC. If the code I was working on that produced the error actually explicitly had const on the paramater I don't remember it. I have to look again. If you remove const here it runs fine.
Uh, it looks like you're trying to code Java in C++.

Correct code: cpp.sh/32yf

Raw:

c++



Here is an image of the memory leak you made too:
http://gyazo.com/2e98773dad7a8eb975a62f4c8b30ac03

Its just a matter of learning how c++ does things differently.

By the way, you should try getting an IDE like Eclipse or something. If you want just a text editor, try Kate - you'll have to manually compile with g++ from the terminal though :^)
Last edited by Fear; May 31, 2015 at 09:09 PM.
Here is how that error shows up in the code I was trying to use:

I am using OpenFrameworks and ofxPostProcessing. The postprocessing stuff basically just wraps some shaders and abstracts their use in OpenFrameworks.

The problem happens in an ofxPostProcessing class that extends an abstract class from OpenFrameworks. PostProcessing extends ofBaseDraws defined in ofBaseTypes.h.


ofBaseDraws


PostProcessing.h
PostProcessing.cpp

These are supposed to be the implementations of the abstract methods in ofBaseDraws. I don't know if the presence or lack of a const qualifier is part of the function signature. There is not a const qualifier on the abstract class method defintions. Taking the const qualifier off the PostProcessing stuff allows it to build.

PostProcessing.h



Here is where the compiler flags the error where draw is called on the frame buffer reference raw and the other draw call on the ping pong frame buffer.

PostProcessing.cpp

I guess this is an error relating to the fact that you can't call non const methods from inside a const function.
But looking at the ofBaseTypes.h, draw(x,y,w,h) is indeed defined as a const method.
Can you post the errors you get?
Edit: Sorry, I believe the OpenFrameworks source I have is older than what is on the Github in my link. Mine is the latest release tag (0073). This link shows the version of ofBaseTypes.h that I have. Note lack of const.

The errors are:
../../../addons/ofxPostProcessing/src/PostProcessing.cpp|162|error: passing ‘const ofFbo’ as ‘this’ argument of ‘virtual void ofFbo::draw(float, float, float, float)’ discards qualifiers [-fpermissive]|

and same basic thing on the next line

../../../addons/ofxPostProcessing/src/PostProcessing.cpp|163|error: passing ‘const ofFbo’ as ‘this’ argument of ‘virtual void ofFbo::draw(float, float, float, float)’ discards qualifiers [-fpermissive]|

If I remove the const qualifier from both draw methods in the PostProcessing class and try to use it, it complains about me trying to declare a variable of an abstract type.

Apparently the const qualifier is part of the method signature, so getWidth and getHeight do not properly override the base class because they include that qualifier and the abstract methods do not. In this case, not all abstract methods are implemented so the subclass is abstract. It works if the qualifier is removed on those as well.
Last edited by RBB; Jun 7, 2015 at 03:50 PM.