lhk / darknet_wrapper

A small wrapper around darknet
12 stars 5 forks source link

Error compiling darknet #9

Open ABesginow opened 6 years ago

ABesginow commented 6 years ago

Hello Lars,

while compiling the darknet directory (Step. 5), I get the following error:

> make
g++ -Iinclude -Isrc -DOPENCV -I/opt/opencv320/include/opencv -I/opt/opencv320/include -Wall -Wfatal-errors -fPIC -Ofast -DOPENCV -c ./src/wrapper_c.c -o obj/wrapper_c.o
./src/wrapper_c.c: In function ‘void setup_network(const char*, const char*)’:
./src/wrapper_c.c:26:36: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
     net = parse_network_cfg(cfgfile);
                                    ^
compilation terminated due to -Wfatal-errors.
Makefile:68: recipe for target 'obj/wrapper_c.o' failed
make: *** [obj/wrapper_c.o] Error 1

Suddenly, the above is compiling....

But ~100 lines later, there is a different error for the same file:

./src/wrapper_c.c: In function ‘detect_img’:
./src/wrapper_c.c:158:16: warning: implicit declaration of function ‘ipl_to_image’ [-Wimplicit-function-declaration]
     image im = ipl_to_image(src);
                ^
./src/wrapper_c.c:158:16: error: invalid initializer
compilation terminated due to -Wfatal-errors.
Makefile:68: recipe for target 'obj/wrapper_c.o' failed
make: *** [obj/wrapper_c.o] Error 1

In my understanding, it is not including the "image.h" file correctly, but I am not sure why.

Is there a way to fix this? Any help is appreciated!

Thanks in advance!

regards Andreas

John-Brooks commented 5 years ago

Too little too late I'm sure, but the problem is that in the image.h file the declaration of ipl_to_image() is contained within an #ifdef OPENCV. So if OPENCV is not defined, then you will get this error. Hopefully this helps someone else.