Asciimatic
Asciimatic copied to clipboard
Compile error
make
returns the following error
gcc -g -Wall -Wextra -std=gnu99 -c src/asciimatic.c -o src/asciimatic.o
In file included from /usr/include/opencv2/core/hal/interface.h:18:0,
from /usr/include/opencv2/core/cvdef.h:91,
from /usr/include/opencv2/core/types_c.h:59,
from /usr/include/opencv2/core/core_c.h:48,
from /usr/include/opencv/cv.h:63,
from src/asciimatic.c:25:
src/main.h:6:15: error: expected identifier before numeric constant
typedef enum {false = 0, true} bool_t;
^
src/asciimatic.c: In function ‘init_templates’:
src/asciimatic.c:62:9: warning: unused variable ‘square_side’ [-Wunused-variable]
int square_side = MAX(char_width, char_height);
^~~~~~~~~~~
src/asciimatic.c: In function ‘init_asciimatic’:
src/asciimatic.c:210:11: warning: implicit declaration of function ‘cvLoadImage’; did you mean ‘cvShowImage’? [-Wimplicit-function-declaration]
src = cvLoadImage(filename, CV_LOAD_IMAGE_GRAYSCALE);
^~~~~~~~~~~
cvShowImage
src/asciimatic.c:210:33: error: ‘CV_LOAD_IMAGE_GRAYSCALE’ undeclared (first use in this function)
src = cvLoadImage(filename, CV_LOAD_IMAGE_GRAYSCALE);
^~~~~~~~~~~~~~~~~~~~~~~
src/asciimatic.c:210:33: note: each undeclared identifier is reported only once for each function it appears in
At top level:
src/asciimatic.c:39:12: warning: ‘num_threads’ defined but not used [-Wunused-variable]
static int num_threads;
^~~~~~~~~~~
make: *** [Makefile:15: src/asciimatic.o] Error 1
on Arch Linux 64-bit, gcc 7.3.0
Interesting - while I get those unused variable warnings, compilation succeeds on my non-Linux machine.
Both those undeclared identifiers, on my machine, are defined in opencv2/highgui/highgui_c.h
, which opencv/highgui.h
includes. It's possible that in the near decade (good lord!) since this code was written, the OpenCV interface changed - looking at the highgui docs[1] for what I assume is a recent version, those identifiers aren't present either. According to pkg-config --libs opencv
, I am linking against version 2.4.13.2, so this project, unfortunately, simply might not compile if you've installed a semi-recent version of OpenCV.
[1] https://docs.opencv.org/3.3.1/d0/d28/group__highgui__c.html
Looking at a few SO threads it appears that at least CV_LOAD_IMAGE_GRAYSCALE has been removed. Might try building an older version of OpenCV from source.
It also seems straightforward, I'd guess, to bump the opencv dependency version and change the usage here; however, real life beckons and I'm short on cycles to take that on for the next little while, so you're likely to get faster results by grabbing an older library version...
No problem, I wasn't expecting you to maintain this in the first place.