LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-29-2015, 12:21 PM   #1
savio
LQ Newbie
 
Registered: May 2015
Posts: 29

Rep: Reputation: Disabled
warning: incompatible implicit declaration of built-in function 'lrint'


Hi,

I want to compile an opencv program on the Linux machine below:

Code:
sav@machine:/shared/sav/test$ uname -a
Linux machine 2.6.32-24-generic #43-Ubuntu SMP Thu Sep 16 14:58:24 UTC 2010 x86_64 GNU/Linux
My gcc command is the following:

Code:
gcc -I/shared/sav/opt/include -L/shared/sav/opt/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lm imagefilter.c -o imagefilter
After I run the program, I have the following warning:
Code:
In file included from /shared/sav/opt/include/opencv2/core/core_c.h:47,
                 from /shared/sav/opt/include/opencv/cv.h:63,
                 from imagefilter.c:1:
/shared/sav/opt/include/opencv2/core/types_c.h: In function 'cvRound':
/shared/sav/opt/include/opencv2/core/types_c.h:327: warning: incompatible implicit declaration of built-in function 'lrint'
How can I fix this warning?
 
Old 07-29-2015, 12:53 PM   #2
firstfire
Member
 
Registered: Mar 2006
Location: Ekaterinburg, Russia
Distribution: Debian, Ubuntu
Posts: 709

Rep: Reputation: 428Reputation: 428Reputation: 428Reputation: 428Reputation: 428
Hi.

Try to move '-lm' before other libraries in the gcc command line.

EDIT: No. You should add #include <math.h> somewhere..

EDIT2: In the example C program from here there is abovementioned line just before cv.h:

Code:
////////////////////////////////////////////////////////////////////////
//
// hello-world.cpp
//
// This is a simple, introductory OpenCV program. The program reads an
// image from a file, inverts it, and displays the result. 
//
////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cv.h>
#include <highgui.h>


int main(int argc, char *argv[])
{
  IplImage* img = 0; 
  int height,width,step,channels;
  uchar *data;
  int i,j,k;

  if(argc<2){
    printf("Usage: main <image-file-name>\n\7");
    exit(0);
  }

  // load an image  
  img=cvLoadImage(argv[1]);
  if(!img){
    printf("Could not load image file: s\n",argv[1]);
    exit(0);
  }

  // get the image data
  height    = img->height;
  width     = img->width;
  step      = img->widthStep;
  channels  = img->nChannels;
  data      = (uchar *)img->imageData;
  printf("Processing a %dx%d image with %d channels\n",height,width,channels); 

  // create a window
  cvNamedWindow("mainWin", CV_WINDOW_AUTOSIZE); 
  cvMoveWindow("mainWin", 100, 100);

  // invert the image
  for(i=0;i<height;i++) for(j=0;j<width;j++) for(k=0;k<channels;k++)
    data[i*step+j*channels+k]=255-data[i*step+j*channels+k];

  // show the image
  cvShowImage("mainWin", img );

  // wait for a key
  cvWaitKey(0);

  // release the image
  cvReleaseImage(&img );
  return 0;
}

Last edited by firstfire; 07-29-2015 at 01:09 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
incompatible implicit declaration of built-in function ‘execl’ ? ? ? jiikka Linux - General 3 05-07-2014 03:09 PM
warning: incompatible implicit declaration of built-in function ‘bzero’ nasim751 Linux - Software 3 04-21-2014 03:39 AM
incompatible implicit declaration of built-in function exit ssvgilchrist Linux - Newbie 1 04-07-2010 01:55 AM
GCC : incompatible implicit declaration of built-in function ‘execlp’ frenchn00b Programming 3 01-12-2010 03:13 AM
warning: incompatible implicit declaration of built-in function ‘exit’ xzotech Programming 1 08-14-2005 05:43 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration