Quick(?) debug assist request (JBand)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PaulBlay
    Knight
    • Jan 2009
    • 657

    Quick(?) debug assist request (JBand)

    There's a linker error that's driving me nuts because I've done exactly what's been done elsewhere in the file and it's not working.

    To cmds.h I added:
    Code:
    extern void do_cmd_switch_lang(void);
    To cmd0.c I added:
    Code:
    	{ L"Switch langage",       KTRL('L'), CMD_NULL, do_cmd_switch_lang }
    and to cmd4.c I added:

    Code:
    /*
     * If in English mode, switch to Japanese (and vice versa)
     */
    static void do_cmd_switch_lang(void)
    {
    	if(arg_language == LNG_ENGLISH)
    		arg_language = LNG_JAPANESE;
    	else
    		arg_language = LNG_ENGLISH;
    }
    And I get the error
    Code:
    cmd0.obj : error LNK2001: unresolved external symbol _do_cmd_lang
    which is odd because cmds.h is properly included and all the other functions in the command list have no problem.

    Anybody have any suggestions?

    If it helps I can upload the latest (uncompilable) version to the subversion repository.
    Currently turning (Angband) Japanese.
  • PowerDiver
    Prophet
    • Mar 2008
    • 2820

    #2
    Originally posted by PaulBlay
    Code:
    /*
     * If in English mode, switch to Japanese (and vice versa)
     */
    static void do_cmd_switch_lang(void)
    {
    	if(arg_language == LNG_ENGLISH)
    		arg_language = LNG_JAPANESE;
    	else
    		arg_language = LNG_ENGLISH;
    }
    And I get the error
    Code:
    cmd0.obj : error LNK2001: unresolved external symbol _do_cmd_lang
    which is odd because cmds.h is properly included and all the other functions in the command list have no problem.
    Your error is the "static" definition. That tells the compiler not to give any code outside that particular file access to that function, externed or not.

    Comment

    • PaulBlay
      Knight
      • Jan 2009
      • 657

      #3
      Originally posted by PowerDiver
      Your error is the "static" definition. That tells the compiler not to give any code outside that particular file access to that function, externed or not.
      Ah! (Oops).

      I intended to copy the do_cmd_save_screen() definition but copied the do_cmd_save_screen_html() definition instead.

      Serves me right for copying instead of thinking.
      Currently turning (Angband) Japanese.

      Comment

      Working...
      😀
      😂
      🥰
      😘
      🤢
      😎
      😞
      😡
      👍
      👎