Undefined reference (nur unter Windows)



  • Hi :)!

    Wollte gerade ein Beispiel, das wir in der FH teilweise programmiert hatten, zu Hause vervollständigen. Nur irgendwie bekomme ich den Code, den ich unter Linux problemlos kompilieren konnte, nicht mehr zum Laufen.
    Ich habe 3 Dateien: main.c, parser.c und parser.h.

    main.c

    #include <stdio.h>
    #include "parser.h"
    
    int main() {
    
      char input[255]; //User input
    
      TCommandList commands; //Input in a parsed form
    
      //...Jede Menge Code...
    
        commands = ParseCommandList(input);
    
      //...Jede Menge Code...
    
      }
    

    parser.c

    #include <stdio.h>
    #include <string.h>
    #include "parser.h"
    
    TCommandList ParseCommandList(char* input) { //Separates a string into pipes (separators: '&' and ';')
    
      //...Jede Menge Code...
    
      }
    

    parser.h

    //Shell (Betriebssysteme Labor)
    //Parser (definitions)
    //Andreas Unterweger, ITS 2004
    
    struct SimpleCommand { //One "token"
    
      char* Text; //Text that will be parsed
    
      char* Command; //The command itself (p.e. "echo")
    
      char* Params[10]; //The parameters of the command
    
      };
    
    typedef struct SimpleCommand TSimpleCommand;
    
    struct Pipe { //Pipe which consists of multiple simple commands
    
      char Text[255]; //Text which will be parsed
    
      TSimpleCommand Pipes[10];
    
      };
    
    typedef struct Pipe TPipe;
    
    struct CommandList { //List of commands which consists of multiple pipes
    
      TPipe Pipes[10];
    
      };
    
    typedef struct CommandList TCommandList;
    
    TCommandList ParseCommandList(char* input); //Separates a string into pipes (separators: '&' and ';')
    

    Dev-C++ wie auch MinGW melden "Undefined reference to 'ParseCommandList'" in main.c. Nur verstehe ich nicht warum... Jemand eine Idee? Unter Linux hat sich das ganze wunderbar kompilieren lassen, nur daheim hab ich kein Linux 😉

    Dust Signs



  • parser.c nicht im project oder makefile ?
    Kurt



  • ZuK schrieb:

    parser.c nicht im project oder makefile ?
    Kurt

    Genau das ist es, danke. Nach 4 Stunden programmieren sieht man manchmal den Wald vor lauter Bäumen nicht mehr 😉

    Dust Signs


Anmelden zum Antworten