Help with Error message

This is a discussion on Help with Error message within the C Programming forums, part of the General Programming Boards category; Hi there, First post on the forum. I would be very greatful if someone could explain why im getting an ...

  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
    Name:  arror(main).jpg
Views: 71
Size:  18.3 KBName:  Error(c).png
Views: 78
Size:  100.7 KBName:  Error(h).jpg
Views: 75
Size:  29.7 KB

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    6,303
    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%.

  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, 10:43 AM

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