This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

#endif for this directive is missing error in .c file

Hi,

I am trying to compile a c file and running into the following error

OBJECT ATSGCHNAAAlibs/qcom_htc.o
"../../wlan/oem/ath/targaddrs_rexos.h", line 44: Warning: #1295-D: Deprecated declaration config_exit - give arg types void config_exit(); ^
"..\..\wlan\oem\qcom_htc.c", line 8000: Warning: #1-D: last line of file ends without a newline QSR_MSG_HIGH( 3772747615ll, "WLAN FC:WLAN registered with FC", 0, 0, 0);//auto-gen, ^
"..\..\wlan\oem\qcom_htc.c", line 7967: Error: #37: the #endif for this directive is missing
..\..\wlan\oem\qcom_htc.c: 2 warnings, 1 error
make[1]: *** [ATSGCHNAAAlibs/qcom_htc.o] Error 1
make: *** [libs] Error 2

Can someone pls help what went wrong?

Thanks in advance

-Gopi

  • "Can someone pls help what went wrong?"

    The compiler is telling you precisely what has gone wrong - just read the messages literally:

    "../../wlan/oem/ath/targaddrs_rexos.h", line 44:
    Warning: #1295-D: Deprecated declaration config_exit - give arg types void config_exit();
    

    It's telling you that the message refers to line 44 in the file targaddrs_rexos.h; "arg" here is short for "argument", so the compiler is telling you to give the argument types for the function config_exit.

    last line of file ends without a newline
    


    Obvious?

    the #endif for this directive is missing
    


    Obvious?

  • "../../wlan/oem/ath/targaddrs_rexos.h", line 44:
    Warning: #1295-D: Deprecated declaration config_exit - give arg types void config_exit();

    The above warning can be ignored.

    I am more worried about the below error

    "..\..\wlan\oem\qcom_htc.c", line 7967: Error: #37: the #endif for this directive is missing
    ..\..\wlan\oem\qcom_htc.c: 2 warnings, 1 error
    make[1]: *** [ATSGCHNAAAlibs/qcom_htc.o] Error 1

    Why is the #endif missing even though the last of the file ends with a new line?

    Thanks

  • When the compiler says that the #endif is missing, you normally have more #if/#ifdef than you have #endif. Pair each open/close token and see if you can find a mismatch.

  • Already did that,It's definetely not because of having more #ifdef's than #endifs or vice-versa.

    I see the exact number of #ifdef's and #endif's

    the line 8000 where it is complaning looks like

    QSR_MSG_HIGH( 3772747615ll, "WLAN FC:WLAN registered with FC", 0, 0, 0);//auto-gen, to change remove 'QSR_' and first param

    Does the comment at the end is blocking from the #endif being detected?

    Thanks

  • Line 8000 just has a warning. Add a newline at the end of the line and the warning will go away.

    But it is the other line that we are discussing.

  • Note that the compiler doesn't care about the boudaries between included files - it just sees that it has reached a point at which it has a #endif without a #if...

    So check if any of your other include files has a mismatch of #ifs to #endifs...

  • Yes, it can be ignored - but you would be wise not to ignore it...