• AVR Freaks

LockedXC8 Conflicting Declarations For Variable

Author
Jon Wilder
New Member
  • Total Posts : 20
  • Reward points : 0
  • Joined: 2010/12/09 11:33:13
  • Location: 0
  • Status: offline
2012/09/14 01:37:27 (permalink)
0

XC8 Conflicting Declarations For Variable

Hi all. I decided to try XC8 with MPLAB IDE 8.86.
 
I'm writing up some external 16x2 LCD functions as well as some external MSSP routines for I2C communication with a 24LCxxx external EEPROM. The LCD code compiles and works fine, but I'm having an issue with my external I2C code.
 
No matter which of the I2C functions I call, I get compiler error 1098 - conflicting declarations for variable "*". I've checked and rechecked the routines in the .c file as well as the function prototypes in the .h file to no end. All of them appear to match. Periodically I have also gotten the "function declared implicit int" warning as well, yet none of the functions are defined as an int.
 
Here are the links to my main.c, msspi2c.c and msspi2c.h files on Pastebin -
 
main.c -
 
http://pastebin.com/dpsccCh2
 
msspi2c.c -
 
http://pastebin.com/6HgrDMzu
 
msspi2c.h -
 
http://pastebin.com/vq8TWZAL
 
And here is the compiler output -
 
http://pastebin.com/F8D2mDPZ
 
Any and all help will be greatly appreciated.
#1

3 Replies Related Threads

    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re:XC8 Conflicting Declarations For Variable 2012/09/14 01:54:05 (permalink)
    0
    You may need to add
    #include "msspi2c.h"
    also to the other C files

    GENOVA :D :D ! GODO
    #2
    NKurzman
    A Guy on the Net
    • Total Posts : 17720
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re:XC8 Conflicting Declarations For Variable 2012/09/14 16:35:27 (permalink)
    +1 (1)
    "function declared implicit int"
     
     This means there was no prototype for this function, so the compiler will assume it all "int's" per ANSI.  Then you will get error when it finds out it guessed wrong.
     
    the "*" error is there a line that goes with that.
    #3
    acavaleiro
    Senior Member
    • Total Posts : 127
    • Reward points : 0
    • Joined: 2011/07/07 09:37:19
    • Location: Portugal
    • Status: offline
    Re:XC8 Conflicting Declarations For Variable 2012/09/14 18:15:35 (permalink)
    +2 (1)
    Hello.
     
    I have read your code, and you just need to add #include "msspi2c.h" in your msspi2c.c file.
    You error is common.
    Look, your main knows about msspi2c.h, your main file knows about the functions, but he don't see the functions with body. Your main file only sees the header functions in your msspi2c.h file. The compiler looks for all the files that includes msspi2c.h file, trying to look for a match functions with code. For this reason you need to include msspi2c.h file in your msspi2c.c file.
    Now your main knows about the headers and the functions with code.
     
    Best regards
    #4
    Jump to:
    © 2019 APG vNext Commercial Version 4.5