#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    10
    Rep Power
    0

    Warning: empty translation unit


    Righty Ho' ladies and Gentlemen


    Another K&R coding warning for you all to take a gander at.

    There will be a few posts (from me) I suspect for the next couple of days/weeks as this is a massive project I am undertaking. I would just like to clarify that I am not be lazy by foruming all of the warnings I come across its just some of these I cannot find any documentation on as I am pretty sure I am using the first ever version of CC (it's probably not that bad but when you're programming in vi because the server you're using doesn't even have vim its pretty painstaking) Sorry for all the bumf, now without further gilding the lily...

    warning: empty translation unit
    Now this is interested because the compiler message tells me this is happening in the blank space and the end of the C file, and unfortunately I do not know what it means by translation unit, I thought..

    Oh! maybe it's a header file or a linked C file
    Could someone clarify if they have seen this before and what are the first things to check. I would upload code, but as it's happening in white space I don't what part to upload.

    Thanks
    Jim
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,392
    Rep Power
    1871
    A translation is simply a single .c file, combined with all the #include file(s) listed within it.

    'empty' just means there was nothing to compile within said file.

    Some scenarios for 'empty' include
    - it actually is empty
    - it's all one big comment, because you have a /* and no matching */
    - it's all in some conditional #if foo .... #endif block covering the whole file.
    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
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    10
    Rep Power
    0
    Thanks, that does seem to be the case, I'll have to look at why it's all surround by an #ifndef.

    Thanks again
    Jim

IMN logo majestic logo threadwatch logo seochat tools logo