Find the answer to your Linux question:
Results 1 to 7 of 7
Hey guys I wrote a program however there is a compilation error that I just don't understand....
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    13

    Compilation error

    Hey guys I wrote a program however there is a compilation error that I just don't understand.

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    There are only two files involved, right? battle.c and battle.h?

    Ok, then. Make copies of them, battle1.c and battle1.h. Make sure you change battle1.c so it #includes battle1.h, not battle.h.

    Then start throwing things out of battle1.c and battle1.h. Make them as tiny as you can and still reproduce the error. Squeeze every unnecessary line out of them.

    On the way, I'm sure you'll find the error.

    If you don't, then take the resultant tiny files (fewer than 25 lines each, I'm sure) and post them here in their entirety so we can compile them too and play with them.

  3. #3
    Just Joined!
    Join Date
    Sep 2007
    Posts
    13
    well there is three files

  4. #4
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Really, the best way to solve this is to follow the advice I gave in post #2. In the long run, you'll get better debugging skills that way.

    But I'll give it a shot with what you posted.

    There is no obvious wrongness in the code you posted. But here's a question: In which file is SIZE #defined?

  5. #5
    Just Joined!
    Join Date
    Sep 2007
    Posts
    13
    its defined in the main file, isn't that correct? It seems that all of them are placed in there right?

  6. #6
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    its defined in the main file, isn't that correct?
    I can't really tell unless you follow the advice in post #2. But if you say that's where it's #defined, here's the next step.

    If SIZE is #defined in work.c, how does the compiler know what SIZE is when it's compiling battle.c? I'm thinking that there's your problem.

    Again, just guessing, because ... well, you know.

  7. #7
    Just Joined!
    Join Date
    Sep 2007
    Posts
    13
    Hey thanks I found out the error with the code. Thanks alot again!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...