New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile with opnecv=1 #932

ahsan856jalal opened this Issue May 30, 2018 · 4 comments


None yet
4 participants

ahsan856jalal commented May 30, 2018

Ubuntu 16.04
python 2.7.14

when I make opencv=1 in Makefile and try to compile it , it gave me this error:

In file included from /usr/local/include/opencv2/core/types_c.h:59:0,
from /usr/local/include/opencv2/core/core_c.h:48,
from /usr/local/include/opencv2/highgui/highgui_c.h:45,
from ./src/image.c:14:
/usr/local/include/opencv2/core/cvdef.h:485:1: error: unknown type name ‘namespace’
namespace cv {
compilation terminated due to -Wfatal-errors.
gcc -DOPENCV pkg-config --cflags opencv -DGPU -I/usr/local/cuda/include/ -DCUDNN -DCUDNN_HALF -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -Ofast -DOPENCV -DGPU -DCUDNN -I/usr/local/cudnn/include -DCUDNN_HALF -c ./src/blas.c -o obj/blas.o
Makefile:130: recipe for target 'obj/image.o' failed
make: *** [obj/image.o] Error 1
make: *** Waiting for unfinished jobs....


This comment has been minimized.

ahsan856jalal commented May 30, 2018

I have 3.4.1 installed when I checked with pkg-config --modversion opencv
while it is showing me 3.4.0 when I do import cv2;cv2.version_ in python environment


This comment has been minimized.

sherlocked777 commented May 30, 2018

I have the same issue, how to get rid of this error? I have OpenCV 3.4.1 installed


This comment has been minimized.


AlexeyAB commented May 30, 2018

@sherlocked777 Install OpenCV 3.4.0.
OpenCV 3.4.1 has a bug in C API.

This repository supports:

both Windows and Linux
both OpenCV 2.x.x and OpenCV <= 3.4.0 (3.4.1 and higher isn't supported)
both cuDNN v5-v7
CUDA >= 7.5
also create SO-library on Linux and DLL-library on Windows

@AlexeyAB AlexeyAB added the Solved label May 30, 2018


This comment has been minimized.

komalpharate commented Jun 4, 2018

I had opencv3.4.1
Uninstalled it completely
Installed 3.3.0
Still getting this namespace bug.
The fix to solve the bug for 3.4.1 is to change modules/core/include/opencv/core/cvdef.h
But this cant work with 3.3.0 as it doesnt have the same cvdef.h file
I have the older darknet yolov2 git version.
I tried make on current darknet, it works fine.
Can I know how to solve it for older darknet ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment