Skip to content
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

Undefined reference to cvRound in opencv 3.2 #8438

Closed
praneethsusarla opened this issue Mar 23, 2017 · 3 comments
Closed

Undefined reference to cvRound in opencv 3.2 #8438

praneethsusarla opened this issue Mar 23, 2017 · 3 comments

Comments

@praneethsusarla
Copy link

praneethsusarla commented Mar 23, 2017

System information (version)
  • OpenCV => 3.2
  • Operating System / Platform => linux Ubuntu 16.04 64 Bit
  • Compiler => gcc
Detailed description

I have recently installed opencv 3.2 in ubuntu 16.04 system and tried to run a C code using opencv library. The code is not compiling because of the following issue:

/tmp/ccwgquWQ.o: In function `cvPointFrom32f':
try.c:(.text+0x54d): undefined reference to `cvRound'
try.c:(.text+0x563): undefined reference to `cvRound'
/tmp/ccwgquWQ.o: In function `cvReadInt':
try.c:(.text+0xe68): undefined reference to `cvRound'
/tmp/ccwgquWQ.o: In function `cvEllipseBox':
try.c:(.text+0x10d4): undefined reference to `cvRound'
try.c:(.text+0x10f6): undefined reference to `cvRound'
collect2: error: ld returned 1 exit status

I have asked a question related to this in stackoverflow and I got the response saying that, its a bug present in opencv3.2. [http://stackoverflow.com/questions/42918747/yolo-c-compilation-failure-with-debug-1]

The reason for calling it as a bug is as follows:
CvRound function has bee defines in types_c.h in opencv2 whereas in opencv3 its not been defined in types_c.h but in core/fast_math.hpp. Despite being not defined in types_c.h its still being called in types_c.h, core_c.h and imgproc_c.h without any reference to fast_math.hpp

I have tried including the "fast_math.hpp" path (#include core/fast_math.hpp) in types_c.h, core_c.h and imgproc_c.h but it didn't solve the issue.

Kindly, look into this issue and get it resolved as early as possible

@praneethsusarla praneethsusarla changed the title Hi, I have installed opencv 3.2.0 in ubuntu 16.04 system and when I run a C code with opencv.. It throws me out the following error Undefined reference to cvRound in opencv 3.2 Mar 23, 2017
@alalek
Copy link
Member

alalek commented Mar 23, 2017

run a C code

OpenCV is C++ library. There is no support for direct C compilation, it doesn't work (crash sometimes, see cvGetSize (#6221) problem). Also OpenCV C API is candidate for removal.

You should compile your program as C++ to use OpenCV.

@praneethsusarla
Copy link
Author

Thats really strange. There are many implementations in C using CUDA and OpenCV and are popular. What about such implementations then ? eg: YOLO

@chichivica
Copy link

Regarding to YOLO specially refer to answer https://stackoverflow.com/a/46808785/2953509

yoshimoto added a commit to yoshimoto/opencv that referenced this issue Feb 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants