Thread: Help with Error message

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    3

    Help with Error message

    Hi there, First post on the forum.

    I would be very greatful if someone could explain why im getting an error message with the function prototypes, and how can i fix this? Thanks.

    Ive attached a printscreen images of my .c, .h, and the main.

  2. #2
    Registered User
    Join Date
    Oct 2012
    Posts
    3
    Help with Error message-arror-main-jpgHelp with Error message-error-c-pngHelp with Error message-error-h-jpg

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    In the header file, the type Robot is unknown. It needs to be known (i.e. visible to the compiler) before it encounters the function declaration, in each compilation unit.

    Since the functions are accepting pointers, you could get away with a forward declaration of Robot (aka "struct Robot;") in the header file. Alternatively, simply #include "robot.h"
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  4. #4
    Registered User
    Join Date
    Oct 2012
    Posts
    3
    Quote Originally Posted by grumpy View Post
    In the header file, the type Robot is unknown. It needs to be known (i.e. visible to the compiler) before it encounters the function declaration, in each compilation unit.

    Since the functions are accepting pointers, you could get away with a forward declaration of Robot (aka "struct Robot;") in the header file. Alternatively, simply #include "robot.h"
    Thanks! Seems to work

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Quote Originally Posted by Holmeslice View Post
    Thanks! Seems to work
    98% of the time.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 13
    Last Post: 10-08-2010, 05:35 PM
  2. Error message
    By Soviet in forum C++ Programming
    Replies: 9
    Last Post: 10-05-2007, 07:39 AM
  3. Error message
    By vopo in forum Windows Programming
    Replies: 5
    Last Post: 10-03-2007, 03:11 AM
  4. new error message for me
    By elad in forum C++ Programming
    Replies: 8
    Last Post: 09-22-2004, 02:48 PM
  5. need help with error message
    By Shy_girl_311 in forum C++ Programming
    Replies: 1
    Last Post: 12-02-2001, 11:43 AM