Thread: what does these mean?

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    19

    what does these mean?

    what does these mean and what should i do when i see the following that appeared when i compile my program:

    warning C206: 'usb_init': missing function-prototype
    warning C206: 'usb_read': missing function-prototype
    error C267: 'usb_read': requires ANSI-style prototype
    warning C206: 'usb_write': missing function-prototype

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    88
    you need to declare the function before running it...

    for example if the function is called "sheep"

    Code:
    /* we declare sheep here */
    void sheep();
    
    int main()
    {
         sheep();
    }
    
    /* this is where you write what sheep will do...*/
    void sheep()
    {
         printf("baaa...");
    }

  3. #3
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    It means that you haven't prototyped the functions before you use them.

    *Edit* Dang. Beaten.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  4. #4
    Registered User
    Join Date
    Jul 2003
    Posts
    19

    thanx a lot

    thanks a lot for that, lithium.
    so does it mean if i, for example, i want to run usb_init, then i would have to put void usb_init() in front, am i right?

  5. #5
    Registered User
    Join Date
    Oct 2002
    Posts
    385

    Re: thanx a lot

    Originally posted by cprogrammer2003
    thanks a lot for that, lithium.
    so does it mean if i, for example, i want to run usb_init, then i would have to put void usb_init() in front, am i right?
    Have you actually read a book on C? Your simple questions you've been asking are answered in any book about the C language.
    Wandering aimlessly through C.....

    http://dbrink.phpwebhosting.com

  6. #6
    Registered User
    Join Date
    Oct 2002
    Posts
    98
    The prototype will depend on the function itself - you are telling the program what variable types (if any) that function needs to be passed, and what variable type it will return.

    For example,

    void sheep();

    is the prototype for a null function returning void. If you wanted to pass a couple of strings to the function, and return an integer to mark whether the function had worked correctly, then it would be like this...

    int sheep( char *string1, char *string2 );

  7. #7
    Registered User
    Join Date
    Jan 2003
    Posts
    88

    Re: thanx a lot

    Originally posted by cprogrammer2003
    thanks a lot for that, lithium.
    so does it mean if i, for example, i want to run usb_init, then i would have to put void usb_init() in front, am i right?
    yes, if you are writing usb_init and it is declared as a void.

    if it's already written in a library for you, then you only need to #include the library.

Popular pages Recent additions subscribe to a feed