LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-26-2020, 09:31 AM   #1
mr_23
LQ Newbie
 
Registered: Mar 2020
Location: India
Posts: 3

Rep: Reputation: Disabled
implicit declaration of function ‘interruptible_sleep_on’


Hi everyone!
I'm trying to make a kernel device driver. while compiling my code I got an error
Quote:
error: implicit declaration of function ‘interruptible_sleep_on’ [-Werror=implicit-function-declaration]
line: interruptible_sleep_on(&wait);
.

and here i have attached the headers for your reference which i used
Quote:
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/cdev.h>
#include <linux/semaphore.h>
#include <linux/ioport.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/miscdevice.h>
#include <linux/types.h>
#include <linux/poll.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/sched.h>
#include <linux/semaphore.h>
#include <linux/fcntl.h>
#include <linux/sched/signal.h>
thank you!!
 
Old 03-26-2020, 09:48 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,873

Rep: Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481
in general "implicit declaration of function" means you call a function before declaration.
In your case you need to include the h file where is it declared (probably linux/wait.h)
 
Old 03-26-2020, 10:04 AM   #3
mr_23
LQ Newbie
 
Registered: Mar 2020
Location: India
Posts: 3

Original Poster
Rep: Reputation: Disabled
yeah, you're right but i thought it's declared in linux/sched.h, but still i have included both the headers.
 
Old 03-28-2020, 02:12 AM   #4
mr_23
LQ Newbie
 
Registered: Mar 2020
Location: India
Posts: 3

Original Poster
Rep: Reputation: Disabled
someone please help me to solve this error
 
Old 03-28-2020, 03:39 AM   #5
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,873

Rep: Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481Reputation: 4481
nothing [more] to say. You need to include the h file (containing the declaration) before calling the function (in the same c file). That is that simple.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
warning: implicit declaration of function liguorir Linux - Software 5 10-22-2012 03:20 PM
warning: implicit declaration of function `snprintf' BiThian Programming 13 10-06-2011 04:26 PM
how to get rid of "warning : implicit declaration of function 'getpid' " ? diodio Linux - Newbie 6 02-01-2006 02:47 PM
warning: incompatible implicit declaration of built-in function ‘exit’ xzotech Programming 1 08-14-2005 05:43 AM
implicit declaration of function 'getdelim' MicahCarrick Programming 2 05-02-2005 11:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:46 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration