473,587 Members | 2,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error: implicit declaration of function `func_name'

I call a function which is named as func_name in file /source/folderA/
fileA.c.

The actual function definition is in /source/folderB/fileB.c.

And I get this error.

warning: implicit declaration of function `func_name'
***Error Code 1

I know that I have to include the file in fileA.c but the library in
which I am working on is clean, i.e. there are no cross includes like
that.

Any other option to do that.
Jun 27 '08 #1
5 3321
DanielJohnson wrote:
I call a function which is named as func_name in file /source/folderA/
fileA.c.

The actual function definition is in /source/folderB/fileB.c.

And I get this error.

warning: implicit declaration of function `func_name'
***Error Code 1

I know that I have to include the file in fileA.c but the library in
which I am working on is clean, i.e. there are no cross includes like
that.

Any other option to do that.
Yes. Include the correct prototype for func_name in a header and include
that header in fileA.c

Jun 27 '08 #2
In article <72************ *************** *******@j33g200 0pri.googlegrou ps.com>,
DanielJohnson <di********@gma il.comwrote:
>I know that I have to include the file in fileA.c but the library in
which I am working on is clean, i.e. there are no cross includes like
that.
Why do you think it is "unclean" to include the necessary header?

If your program has a structure you consider unclean, then restructure
the program. Don't try to hide the dirtiness by not including the
necessary headers.

-- Richard
--
In the selection of the two characters immediately succeeding the numeral 9,
consideration shall be given to their replacement by the graphics 10 and 11 to
facilitate the adoption of the code in the sterling monetary area. (X3.4-1963)
Jun 27 '08 #3
On Jun 18, 2:37 am, DanielJohnson <diffuse...@gma il.comwrote:
I call a function which is named as func_name in file /source/folderA/
fileA.c.

The actual function definition is in /source/folderB/fileB.c.

And I get this error.

warning: implicit declaration of function `func_name'
***Error Code 1
If your function is "int foo(int a)" either declare that in a header
and include the header:
/* foo.h */
#ifndef _FOO_H
#define _FOO_H
int foo(int a);
#endif

/* fileA.c */
#include "foo.h"

or declare the function in your source file:
/* fileA.c */
extern int foo(int );

Including header is cleaner than the extern declarations. If the
function prototype is not encountered, a standard complying compiler
is required to show diagnostics. Before standardization , prototypes
were not required and functions were assumed to be returning int with
variable number of arguments.
I know that I have to include the file in fileA.c but the library in
You don't include the .c files but the header files.
which I am working on is clean, i.e. there are no cross includes like
that.
What do you mean by a cross include?
Jun 27 '08 #4
rahul wrote:

<snip>
Before standardization , prototypes
were not required and functions were assumed to be returning int with
variable number of arguments.
I suppose it would be more correct to say that before standardisation
function declarations specified the function name and return type and
that it took unspecified arguments.

<snip>

Jun 27 '08 #5
On Jun 18, 3:58 pm, santosh <santosh....@gm ail.comwrote:
rahul wrote:

<snip>
Before standardization , prototypes
were not required and functions were assumed to be returning int with
variable number of arguments.

I suppose it would be more correct to say that before standardisation
function declarations specified the function name and return type and
that it took unspecified arguments.

<snip>
Yup...that would be more appropriate...
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4731
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
5
1962
by: hpy_awad | last post by:
I wrote that example from a book and there is en error in the display module that it does not showing all the records are entered in the input module. I traced with some printf statments without getting the solution . I think the error in the display module loop condition. Thanks #include <stdio.h>
13
504
by: Bill | last post by:
Can someone help me with this error: error C2143: syntax error : missing ';' before 'type' Here is the line it's complaining about: for(int i=0;i<4;i++){ printf("%d",x); }
7
3306
by: i | last post by:
#include<stdio.h> #include<conio.h> #include<process.h> #include<string.h> char ch; int w; int n,m; //void main(); char check(int n,int m,char ch); void cash(int n,int m,char ch);
29
8066
by: Ravishankar S | last post by:
Dear C Experts, While prepating a content for a C course,I made section on function prototypes. Could you kindly provide me your comments on its correctness. Thank you ! Q12: What is the difference between a function prototype and a function declaration? If you get this right, you must have done fair amount of research on C
11
4392
by: =?UTF-8?Q?Filip_Gruszczy=C5=84ski?= | last post by:
Hello everyone! It is my first message on this list, therefore I would like to say hello to everyone. I am fourth year student of CS on the Univeristy of Warsaw and recently I have become very interested in dynamically typed languages, especially Python. I would like to ask, whether there is any way of explicitly declaring variables used...
5
3656
by: Just Another Victim of the Ambient Morality | last post by:
I have a peculiar bug in my PHP code. It looks something like this: Fatal error: Cannot redeclare func_name() (previously declared in script.php:57) in script.php on line 57 I've done a search and determined that "func_name" really is unique. Besides, how is this even possible? It was previously declared on the same line it's declared?...
7
70276
by: singhPrabhat | last post by:
Hi, I am using gcc (GCC) 4.2.1 (SUSE Linux). SUSE 10.3 While compiling a .c file I get following error :::: CCWebConfiguration.h:70: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘extern’ CCWebBrowser.c: In function ‘main’:
2
6346
by: akhilesh.noida | last post by:
I am trying to compile glibc-2.5 for ARM based board. But I am getting errors while configuring it. Please check and give your inputs for resolving this. configure command : $ ../glibc-2.5/configure --prefix=/mnt/new/Mars/glibc_HQ_test/GLIBC/ install/ --with-__thread --enable-kernel=2.6.11 --enable-shared
0
7843
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8206
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6621
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5713
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.