• AVR Freaks

Hot!implicit declaration of function '**_**' is invalid in C99

Author
MOHAEGY
Starting Member
  • Total Posts : 89
  • Reward points : 0
  • Joined: 2020/05/27 11:33:24
  • Location: 0
  • Status: offline
2020/10/01 11:11:29 (permalink)
5 (1)

implicit declaration of function '**_**' is invalid in C99

Hello every one 
I have a very large program  may be more than 8000 code line and because many programmers says that you main.c must be less than 1000 line So, i have a big problem here where i have three main blocks of codes in my MAIN.C file and have three header files (file.h), each block include a called functions from header files
*- Now when i want to make a header file and translate one of these big blocks to it this message appear to me "implicit declaration of function '**_**' is invalid in C99" for every called function from header files  with many errors due to every big block of code have a called function from one of header files
WHAT is the best way to minimize the MAIN.C file and transfer blocks to another file where i can just call the block in the main file 
thanks 
#1

15 Replies Related Threads

    1and0
    Access is Denied
    • Total Posts : 11325
    • Reward points : 0
    • Joined: 2007/05/06 12:03:20
    • Location: Harry's Gray Matter
    • Status: offline
    Re: implicit declaration of function '**_**' is invalid in C99 2020/10/01 11:22:14 (permalink)
    +1 (1)
    Robotics011
    ... have three header files (file.h), each block include a called functions from header files
    *- Now when i want to make a header file and translate one of these big blocks to it this message appear to me "implicit declaration of function '**_**' is invalid in C99" for every called function from header files  with many errors due to every big block of code have a called function from one of header files

    Code in header files should NOT call functions.
    #2
    NKurzman
    A Guy on the Net
    • Total Posts : 18975
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: implicit declaration of function '**_**' is invalid in C99 2020/10/01 11:24:47 (permalink)
    +1 (1)
    First you have the Option to tell the compiler to use C90 ode.
    implicit declaration of function means you do not have Prototypes for your functions.
    You should have a Prototype before the function is used.
     
    "call the block"  I assume your Blocks are functions.
    #3
    ric
    Super Member
    • Total Posts : 28660
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: implicit declaration of function '**_**' is invalid in C99 2020/10/01 13:22:42 (permalink)
    +4 (4)
    Robotics011
    WHAT is the best way to minimize the MAIN.C file and transfer blocks to another file where i can just call the block in the main file 

    I guess you have never worked with a project containing multiple C files.
    Header files should NOT contain executable code.
    Have a read of:
    Organizing Code Files in C and C++ (Ignore the C++ specific bits)
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #4
    MOHAEGY
    Starting Member
    • Total Posts : 89
    • Reward points : 0
    • Joined: 2020/05/27 11:33:24
    • Location: 0
    • Status: offline
    Re: implicit declaration of function '**_**' is invalid in C99 2020/10/01 14:35:27 (permalink)
    0
    Dear/ RIC actually yes  i will read : Organizing Code Files in C and C++  
    WHEN i convert to C90 i open the door of hill there are many warning: (373) implicit signed to unsigned conversion and (359) illegal conversion between pointer types
    " "call the block"  I assume your Blocks are functions." ===> every block of the main three blocks contains call functions, and executable codes using "if , while ,and others 
    #5
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 12014
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: implicit declaration of function '**_**' is invalid in C99 2020/10/01 14:44:10 (permalink)
    +2 (2)
    At a minimum, you should be concerned about the "illegal conversion between pointer types" warnings.
    #6
    MOHAEGY
    Starting Member
    • Total Posts : 89
    • Reward points : 0
    • Joined: 2020/05/27 11:33:24
    • Location: 0
    • Status: offline
    Re: implicit declaration of function '**_**' is invalid in C99 2020/10/01 15:00:37 (permalink)
    0 (2)
    Now after i read the article Organizing Code Files in C and C++  i discovered that we split C file to many files just for easymodify and maintenance just for things like that not for performance 
    So, if my MAIN.C have a 10000 line no problem and not affect the performance of my project 
    am i right?
     
    #7
    Antipodean
    Super Member
    • Total Posts : 1922
    • Reward points : 0
    • Joined: 2008/12/09 10:19:08
    • Location: Didcot, United Kingdom
    • Status: offline
    Re: implicit declaration of function '**_**' is invalid in C99 2020/10/01 15:25:12 (permalink)
    +3 (3)
    splitting your code up does several things: -
    It modularises your code so you can isolate sections. I.e. have separate files for things like UART, SPI, I2C for example. This also allows you to have private variables in each module, which can also reduce unwanted interactions between parts of your code.
    By separating the code out into separate files only the file you are currently changing needs to be compiled before it gets linked with the other files, giving faster compile times, especially if the compiler can use multiple threads if you change several files. If everything is in one large file then the whole file has to be compiled each time.
    With separate files error messages can include the file name so you know which module to look in to find the problem, rather than paging through a horrendously large file. 
     

    Do not use my alias in your message body when replying, your message will disappear ...

    Alan
    #8
    ric
    Super Member
    • Total Posts : 28660
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: implicit declaration of function '**_**' is invalid in C99 2020/10/01 16:30:24 (permalink)
    0 (2)
    Someone has quoted Anti-podean's post without paying attention to the big warning in his signature.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #9
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 12014
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re: implicit declaration of function '**_**' is invalid in C99 2020/10/01 16:48:36 (permalink)
    +1 (1)
    So, if my MAIN.C have a 10000 line no problem and not affect the performance of my project am i right?

     
    The number of lines of code in a C file has nothing to do with performance.
    #10
    ric
    Super Member
    • Total Posts : 28660
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: implicit declaration of function '**_**' is invalid in C99 2020/10/01 16:57:14 (permalink)
    +1 (1)
    As above.
    Also, anything moved into a header file, and then #included into a C file, is treated exactly the same as if it was in the C file all along.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #11
    MOHAEGY
    Starting Member
    • Total Posts : 89
    • Reward points : 0
    • Joined: 2020/05/27 11:33:24
    • Location: 0
    • Status: offline
    Re: implicit declaration of function '**_**' is invalid in C99 2020/10/01 17:14:55 (permalink)
    0
    OK that's good and i will split my code  it's my time to learn MODULAR programming structure 
    So, let's we see how i can do that or not and i will attached some of codes where i face a problem  
    #12
    MOHAEGY
    Starting Member
    • Total Posts : 89
    • Reward points : 0
    • Joined: 2020/05/27 11:33:24
    • Location: 0
    • Status: offline
    Re: implicit declaration of function '**_**' is invalid in C99 2020/10/02 04:17:11 (permalink)
    -1 (1)
    Now as my attachment my MAIN.C contains 3 big blocks ( run mode, inspection mode and programming mode ) each block call functions from LCD.H, INPUT.h, OUTPUT.h and also INPUT.C  when i create header and c files for one of these 3 blocks to transfer it from MAIN.C there are a lot of errors 
    WHAT i do wrong?

    Attached Image(s)

    #13
    mlp
    boots too small
    • Total Posts : 967
    • Reward points : 0
    • Joined: 2012/09/10 15:12:07
    • Location: previously Microchip XC8 team
    • Status: offline
    Re: implicit declaration of function '**_**' is invalid in C99 2020/10/02 15:34:25 (permalink)
    +1 (1)
    Robotics011
    WHAT i do wrong?

    Still not show your actual code, and insist on describing it to us using imprecise or incorrect terms.
     
    Either
    • learn the correct-according-to-the-standard terms for the constructs within your code, and use those to describe what you have done when splitting your code, or
    • show us the actual code
    Only then will we be able to tell you what you've done wrong within that code using language that we'll both understand.

    Mark (this opinion available for hire)
    #14
    ric
    Super Member
    • Total Posts : 28660
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: implicit declaration of function '**_**' is invalid in C99 2020/10/02 16:23:53 (permalink)
    +1 (3)
    I would guess you made a mistake somewhere arond line#42 of input.c
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #15
    Jump to:
    © 2020 APG vNext Commercial Version 4.5