title: Call a method using switch case from another C file?
body: <p>I'm trying to call methods &quot;choice_1&quot; &amp; &quot;choice_2&quot; from the Choice.c file, using switch case statements I wanted to call the options after an input was taken in the Menu.c file and return the results, the menu is in a loop and works, I know this because I moved the methods from the Choice.c file into the Menu.c file, a few adjustments and everything works, but not when they are in separate files...</p>
  <p>I have &quot;#includes Menu.h&quot; in the header of both files.</p>
  <p>I also have 2 functions in the header file:</p>
  <pre><code>void choice_1(int * count, char * text);
  void choice_2(int * count, char * string);
  </code></pre>
  <p>When I try to compile Menu.c I get</p>
  <blockquote>
  <p>[Linker error] undefined reference to 'choice_1'</p>
  <p>[Linker error] undefined reference to 'choice_2'</p>
  </blockquote>
  <p>Menu.c</p>
  <pre><code>int main(void){
  int count[2];
  ...
  while(TRUE) {
        printf(&quot;%s\n&quot;, &quot;Menu:&quot;);
        printf(&quot;%s\n&quot;, &quot;1) Option 1&quot;);
        printf(&quot;%s\n&quot;, &quot;2) Option 2&quot;);
        ...
        printf(&quot;%s\n&quot;, &quot;5) Exit&quot;);         
        fgets (userinput)...
  ...
        switch(userinput){
            case 1:
                choice_1(count);
                break;
            case 2:
                choice_2(count);
                break;
            ...
            case 5:
                return(EXIT_SUCCESS);
                break;
  ...
  </code></pre>
  <p>Choice.c</p>
  <pre><code>....
  void choice_1(int * count, char * text){
  ....
  }
  void choice_2(int * count, char * string){
  ....
  }
  </code></pre>
  <p>It just doesn't call the 2 methods, What am i doing wrong ? :S</p>