How to include an addon

I am trying to use https://github.com/julapy/ofxDither

following the example in https://github.com/aman-tiwari/dither-thing I have a working project, but I have ofxDither.h and ofxDither.cpp into my projects src dir. which I ‘know’ is not right.

I am pretty sure I have followed the instructions at
openframeworks. cc/learning/01_basics/how_to_add_addon_to_project/
and the faq at ofxaddons pages/howto#install

/home/carl/src/alg/goo/src/ofApp.h:6:10: fatal error: ofxDither.h: No such file or directory
6 | #include “ofxDither.h”
| ^~~~~~~~~~~~~

carl@twist:~/src/alg/goo$ cat addons.make
ofxDither

I am going out on a limb now, but shouldn’t I see addons and ofxDither in the -l’s?

make[1]: Entering directory ‘/home/carl/src/alg/goo’
Compiling /home/carl/src/alg/goo/src/ofApp.cpp
g++ -c -O3 -march=native -mtune=native -DNDEBUG -Wall -Werror=return-type -std=c++14 -DGCC_HAS_REGEX -DOF_USING_GTK -DOF_USING_GTK -pthread -D_REENTRANT -pthread -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/include/gstreamer-1.0 -I/usr/include/AL -I/usr/include/x86_64-linux-gnu -I/usr/include/rtaudio -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/fmodex/include -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/glm/include -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/glm/include/glm -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/glm/include/glm/ext -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/glm/include/glm/gtc -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/glm/include/glm/gtx -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/glm/include/glm/simd -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/glm/include/glm/detail -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/json/include -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/kiss/include -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/pugixml/include -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/tess2/include -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/utf8/include -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/utf8/include/utf8 -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/openFrameworks -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/openFrameworks/3d -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/openFrameworks/communication -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/openFrameworks/utils -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/openFrameworks/graphics -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/openFrameworks/events -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/openFrameworks/types -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/openFrameworks/math -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/openFrameworks/gl -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/openFrameworks/video -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/openFrameworks/app -I/home/carl/of/of_v0.11.0_linux64gcc6_release//libs/openFrameworks/sound -I/home/carl/src/alg/goo/src -MMD -MP -MF obj/linux64/Release/src/ofApp.d -MT obj/linux64/Release/src/ofApp.o -o obj/linux64/Release/src/ofApp.o -c /home/carl/src/alg/goo/src/ofApp.cpp

Hey @CarlFK,
it seems that this fork is 7 years old. Then could be not updated to current OF version.

If you search on GitHub like this:

ofxDither fork:true

You can look for other forks maybe more up to date. Like this one from 2018:

I do not tested none of the repositories, but just trying to suggest some helping.

oops. I made a very fast check of this more recent repo but is not working neither.
The ofxDither.h/.cpp files are missing.
So, I tried the 2 files from the original repo,
both moved into OF/addons/ofxDither/src/
(where the ofxAddons src must be placed)
but I am having some errors too:

note: see declaration of 'ofImage_<unsigned char>::loadImage'
1>f:\openframeworks\addons\ofxdither\ditherexample\src\ofapp.cpp(52): error C2248: 'ofImage_<unsigned char>::width': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(642): note: see declaration of 'ofImage_<unsigned char>::width'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>f:\openframeworks\addons\ofxdither\ditherexample\src\ofapp.cpp(57): error C2248: 'ofImage_<unsigned char>::height': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(643): note: see declaration of 'ofImage_<unsigned char>::height'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(71): error C2248: 'ofImage_<unsigned char>::width': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(642): note: see declaration of 'ofImage_<unsigned char>::width'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(72): error C2248: 'ofImage_<unsigned char>::height': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(643): note: see declaration of 'ofImage_<unsigned char>::height'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(123): error C2248: 'ofImage_<unsigned char>::width': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(642): note: see declaration of 'ofImage_<unsigned char>::width'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(124): error C2248: 'ofImage_<unsigned char>::height': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(643): note: see declaration of 'ofImage_<unsigned char>::height'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(222): error C2248: 'ofImage_<unsigned char>::width': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(642): note: see declaration of 'ofImage_<unsigned char>::width'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(223): error C2248: 'ofImage_<unsigned char>::height': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(643): note: see declaration of 'ofImage_<unsigned char>::height'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(345): error C2248: 'ofImage_<unsigned char>::width': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(642): note: see declaration of 'ofImage_<unsigned char>::width'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(346): error C2248: 'ofImage_<unsigned char>::height': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(643): note: see declaration of 'ofImage_<unsigned char>::height'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(350): error C2248: 'ofImage_<unsigned char>::bpp': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(644): note: see declaration of 'ofImage_<unsigned char>::bpp'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(352): error C2440: '=': cannot convert from 'ofPixels_<unsigned char>' to 'unsigned char *'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(352): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(360): error C2440: '=': cannot convert from 'ofPixels_<unsigned char>' to 'unsigned char *'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(360): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(365): error C2248: 'ofImage_<unsigned char>::width': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(642): note: see declaration of 'ofImage_<unsigned char>::width'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(366): error C2248: 'ofImage_<unsigned char>::height': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(643): note: see declaration of 'ofImage_<unsigned char>::height'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(367): error C2248: 'ofImage_<unsigned char>::bpp': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(644): note: see declaration of 'ofImage_<unsigned char>::bpp'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(357): warning C4996: 'ofImage_<unsigned char>::getPixelsRef': Use getPixels() instead
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(411): note: see declaration of 'ofImage_<unsigned char>::getPixelsRef'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(380): error C2248: 'ofImage_<unsigned char>::width': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(642): note: see declaration of 'ofImage_<unsigned char>::width'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>f:\openframeworks\addons\ofxdither\src\ofxdither.cpp(381): error C2248: 'ofImage_<unsigned char>::height': cannot access protected member declared in class 'ofImage_<unsigned char>'
1>f:\openframeworks\libs\openframeworks\graphics\ofimage.h(643): note: see declaration of 'ofImage_<unsigned char>::height'
1>f:\openframeworks\libs\openframeworks\graphics\ofgraphicsbasetypes.h(21): note: see declaration of 'ofImage_<unsigned char>'
1>Done building project "ditherExample.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========

hey @CarlFK i had a quick look and forked the addon - there were a load of deprecated calls but have fixed the issues and both examples work now (oF v_0.11. on OSX )
you can download or fork the new addon here

to use ofxDither in your own projects (depending on your platform) you can use the project generator to make a new project then select ofxdither from the addons menu (this will just list any addons in your openframeworks/addons/ folder ) then - provided it is being called into your ofApp.h file with the

#include "ofxDither.h"

command - this will then make all the dither capabilities available to your application>>> (screenshot from Xcode on osx showing the addon linked to the project (in the folder structure in the sidebar) and explicitly added in the ofApp.h file)

1 Like

Thanks for looking at the addon and fixing it, but that does not solve my problem:

/home/carl/src/alg/goo/src/ofApp.h:6:10: fatal error: ofxDither.h: No such file or directory
6 | #include “ofxDither.h”

To double check, I cloned your update:

carl@twist:~/of/of_v20201229_linux64gcc6_release/addons$ git clone git@github.com:julapy/ofxDither.git

use the project generator to make a new project then select ofxdither from the addons menu

did that

… into your ofApp.h file with the

#include "ofxDither.h"

and that

yet still I get the error:

carl@twist:~/of/of_v0.11.0_linux64gcc6_release/apps/myApps/mySketch$ make 
...
/home/carl/of/of_v0.11.0_linux64gcc6_release/apps/myApps/mySketch/src/ofApp.h:4:10: fatal error: ofxDither.h: No such file or directory
    4 | #include "ofxDither.h"
      |          ^~~~~~~~~~~~~

If I understand, there is a command line project generator? posting screen shots of gui steps makes me grumpy :stuck_out_tongue: