Thread: conflicting types for aprintfa

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    222

    Thumbs up conflicting types for aprintfa

    Hi All

    I get following error while compiling in gcc. please help me.

    generate.h:140: error: conflicting types for âprintfâ
    generate.h:140: note: a parameter list with an ellipsis canât match an empty parameter name list declaration
    generate.h:140: error: conflicting types for âscanfâ
    generate.h:140: note: a parameter list with an ellipsis canât match an empty parameter name list declaration
    generate.h:140: error: conflicting types for âfprintfâ
    generate.h:140: note: a parameter list with an ellipsis canât match an empty parameter name list declaration
    root@user-desktop:/home/user/test2# conflicting types for âprintf


    here is the code below with line number.

    139 /* library functions */
    140 extern int printf(),scanf(),fprintf();
    141 extern void exit();
    142
    143 extern double drand48();
    144 extern long lrand48();
    145 extern void srand48();

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    DO NOT declare function prototypes for system functions.
    Only declare function prototypes for functions you are going to implement (supply) in your own code.

    NOTE: If you really want to do function prototypes for system functions; they must match the real function prototypes or you get an error like you are getting.

    NOTE: If you wish to use your own version instead of system functions of the same name; you must NOT include system headers that declare the system functions.

    Tim S.
    Last edited by stahta01; 03-12-2012 at 09:13 AM.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #3
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    Quote Originally Posted by leo2008 View Post
    Hi All
    please help me.
    OK, whatever book you're learning from, please throw it away. That code is wrong on so many levels...
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. stuck with conflicting types for
    By rukshan in forum C Programming
    Replies: 3
    Last Post: 09-27-2011, 01:00 AM
  2. Conflicting types error
    By mastrxplodr in forum C Programming
    Replies: 4
    Last Post: 04-12-2011, 11:56 AM
  3. conflicting types for getline() fix
    By saqib_ in forum C Programming
    Replies: 4
    Last Post: 04-05-2010, 04:04 AM
  4. Conflicting types???
    By kwikness in forum C Programming
    Replies: 11
    Last Post: 10-07-2007, 11:53 PM
  5. conflicting types for...
    By dudinka in forum C Programming
    Replies: 3
    Last Post: 05-14-2005, 07:03 AM