Stupid compiler

This is a discussion on Stupid compiler within the C Programming forums, part of the General Programming Boards category; I am getting the error message on line 170 "Missing prototype for 'getquote'". Yet line 170 is the start of ...

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    43

    Stupid compiler

    I am getting the error message on line 170 "Missing prototype for 'getquote'".

    Yet line 170 is the start of my function!

    Code:
    float getquote() {
    The whole program is rather long so I wont post it all here, but does anyone know why the compiler is not recognising my function?

  2. #2
    Registered User mitakeet's Avatar
    Join Date
    Jun 2005
    Location
    Maryland, USA
    Posts
    212
    It is 99.9% likely somewhere else in your program. Try to replicate the problem in a small amount of code, who knows? you might figure it out yourself.

    Free code: http://sol-biotech.com/code/.

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    This is a prototype
    float getquote();

    > but does anyone know why the compiler is not recognising my function?
    Perhaps it's gcc with the -Wmissing-prototypes warning enabled?

    Of course, if you'd actually stated your OS and compiler, then there would be less guessing going on right?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Dec 2004
    Posts
    43
    ok i have fixed it. For some reason the compiler didnt like the brackets being empty, so I have added VOID to the brackets. This seems strange as my int main function works fine without this. Anyway it was the Pelles C compiler for windows.

  5. #5
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    Use a better compiler like GCC (free) or MSVC (not free).

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    > This seems strange as my int main function works fine without this.
    Now you know why main is special

    It's probably warning you that foo ( ) is really the equivalent (in C) of foo ( ... ), which is basically "I don't care about parameters".
    If you really mean void, then you should start saying so (empty parameter declarations are on the deprication path in C as far as I know).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie Problem: Stupid Compiler Error
    By iSlak in forum C++ Programming
    Replies: 4
    Last Post: 08-22-2005, 05:34 AM
  2. Have you ever written a compiler?
    By ammar in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 12-27-2004, 06:10 AM
  3. Dev C++ Compiler, Indentation?
    By Zeusbwr in forum C++ Programming
    Replies: 3
    Last Post: 10-21-2004, 06:13 AM
  4. lcc win32 compiler download problems
    By GanglyLamb in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 08-01-2004, 07:39 PM
  5. Special Compiler for win app's
    By Unregistered in forum Windows Programming
    Replies: 19
    Last Post: 04-26-2002, 03:52 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21