Like Tree1Likes
  • 1 Post By memcpy

error: variable ‘TIMEOUT’ has initializer but incomplete type

This is a discussion on error: variable ‘TIMEOUT’ has initializer but incomplete type within the C Programming forums, part of the General Programming Boards category; Why does: Code: static struct timeval TIMEOUT = { 25, 0 }; Give me this error: error: variable ‘TIMEOUT’ has ...

  1. #1
    Registered User
    Join Date
    Jan 2012
    Posts
    59

    error: variable ‘TIMEOUT’ has initializer but incomplete type

    Why does:

    Code:
    static struct timeval TIMEOUT = { 25, 0 };
    Give me this error:

    error: variable ‘TIMEOUT’ has initializer but incomplete type
    warning: excess elements in struct initializer
    warning: (near initialization for ‘TIMEOUT’)

    ???
    Last edited by evb@studioe.com; 01-06-2012 at 05:37 PM.

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Probably because timeval is not defined anywhere...

  3. #3
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,323
    evb@studioe.com:
    You should Google your error messages before coming here to ask. Most of the compiler messages you're getting have been explained numerous times on numerous forums. We're happy to help, but there's no sense in us answering it again.

  4. #4
    Registered User
    Join Date
    Dec 2011
    Posts
    795
    Am I the only one that's suspicious that this guy copied code from somewhere and is trying to get it to compile?

    I mean, 3 minutes before this thread --> error: expected ‘)’ before ‘*’ token
    Salem likes this.

  5. #5
    Registered User
    Join Date
    Jan 2012
    Posts
    59
    memcpythat's exactly what I'm doing. The software is Varkon and I'm trying to determine if it will run under Cygwin. Apparently others have tried but I see no answers as to whether anyone has succeeded so I figured I'd give it a go.

    anduril462 I googled it first, usually do. Still no idea as to whether there are multiple versions of timeval (c v. c++) and I'm using the wrong one OR if it's part of a library that I don't know about OR if the documentation I'musing is inaccurate OR if I've actually misspelled something.

    I'm only guessing as to what an initializer is to begin with.

    All I know is every example I have found thus far says my syntax is correct.
    I apologize if I have sent this question to the experts forum by mistake.

  6. #6
    Registered User
    Join Date
    May 2009
    Posts
    2,372
    You are once again missing the right header.

    The compiler does not know everything about type "timeval".

    Tim S.
    Last edited by stahta01; 01-09-2012 at 12:40 PM. Reason: grammer
    "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the Universe is winning." Rick Cook

  7. #7
    Registered User
    Join Date
    Jan 2012
    Posts
    59
    Thanks stahta01 !!!
    Turns out there was a typo in the d/l. It was including the wrong time.h.
    4 days later and she finally compiles without a hitch.

    fyi-Varkon_1.19D does NOT run under Cygwin. At least not for me.

    cheers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 05-23-2011, 02:04 PM
  2. error: array type has incomplete element type
    By gerger in forum C Programming
    Replies: 8
    Last Post: 10-05-2010, 07:40 AM
  3. Replies: 3
    Last Post: 05-01-2010, 02:26 AM
  4. Compile Error: Incomplete Type
    By estebbins in forum C Programming
    Replies: 2
    Last Post: 07-07-2008, 10:00 PM
  5. error: field has incomplete type
    By kris.c in forum C Programming
    Replies: 11
    Last Post: 06-12-2007, 03:53 PM

Tags for this Thread


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