tutorials.de Buch-Aktion 05/2012
ERLEDIGT
JA
ANTWORTEN
3
ZUGRIFFE
519
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    derNero derNero ist offline Rookie
    Registriert seit
    Nov 2006
    Beiträge
    8
    Hallo,

    ich hab in mein Programm eine Klasse (ftp) eingebunden und es funktioniert soweit alles super.

    Ich kann alle public methoden benutzen nur wenn ich eine bestimmte methode aufrufen will bringt der compiler/linker folgenden Fehler:

    Error: Unresolved external 'ftp:oShellCommand(char *)' referenced from C:\PROGRAM FILES\BORLAND\BCC55\BIN\CSV2CMX1.2.OBJ

    Programm:
    Code :
    1
    2
    3
    4
    5
    6
    
    void ftptransfer(string host, string user, string pass, string partfile){
        ftp theFtpConnection;
        theFtpConnection.DoOpen("xxxxxxx");
        theFtpConnection.DoLogin("xxxxxxx");
        theFtpConnection.DoShellCommand("!dir");
    }

    Header der Klasse:
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    
    #ifndef __ftp__
    #define __ftp__
     
    #include <io.h>
     
    #define DEFAULT_PORT_NUM 21
     
    #define PASSWORD_LENGTH 256
     
    #define EINTR WSAEINTR 
     
    #define bzero(x,y) memset(x,0,y)
     
    #define bcopy(x,y,z) memcpy(y,x,z)
     
    #define closeS closesocket
     
    enum {
     LS = 0,
     BINARY,
     ASCII,
     PWD,
     CD,
     OPEN,
     CLOSE,
     QUIT,
     LCD,
     LLS,
     LDIR,
     USER,
     SHELL,
     IGNORE_COMMAND,
     GET,
     PUT,
     HELP,
     RHELP,
     
     FTP_COMPLETE=1, /* these will be used later */
     FTP_CONTINUE,
     FTP_ERROR
    };
     
     
    class ftp {
     
    public:
        
        ftp();
        ~ftp();
     
        void DoOpen(char *);
        void DoList(char *);
        void DoCD(char *);
        void DoLogin(char *);
        void DoClose(void);
        void DoLCD( char *);
        void DoPut( char *);
        void DoGet( char *);
        void DoLLS(char * );
        void DoShellCommand(char *);
        void DoBinary();
        void DoRhelp( char *);
        void DoAscii();
        void DoPWD();
     
        int  CheckFds(char *);
     
    private:
        char szBuffer[1025];  /* buffer used to read/write */
        char szUser[20];          /* stores username */
        char szPass[256];         /* stores user password */
        int Connected;     /* flag for connect status */
     
        
        int hListenSocket;
        int hControlSocket;
        int hDataSocket;    
        int bSendPort;
        int ReadCommand;
        int bMode;
     
        int GetReply();
        int GetLine();
        void CleanUp();
        int SendControlMsg(char *, int);
        int SendDataMsg( char *szBuffer, int len);
        int ConnectToServer(char *name, char *port);
        int GetListenSocket();
        int InitWinsock();
        int AcceptConnection();
        void CloseControlConnection( void );
        void CloseDataConnection( int hDataSocket );
        void CloseListenSocket();
        int ReadDataMsg( char *szBuffer, int len);
        void GetPassword( char *szPass );
        int GetUnixInput(char *command);
        int GetWin32Input( char *command);
        void GetFile( char *fname);
        void PutFile( char *fname);
        int ReadControlMsg( char *szBuffer, int len);
        int CheckControlMsg( char *szPtr, int len);
        int CheckInput();
     
    };
     
    #endif

    Codeausschnitt der Klasse
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    
    #include <ftp.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <ctype.h>
    #include <time.h>
    #include <winsock.h>
    #include <direct.h>
    #include <wincon.h>
    #include <signal.h>
    #include <conio.h> 
     
     * function to pass commands to the system, ie: dir.
     * this function gets called when '!' is encountered
     */
    void DoShellCommand( char *command )
    {
    command++;  /* ignore '!' */
    #if ( !defined(_WIN32) || !defined(WIN32) )
     
        system(command);
    #else
        if( !command || !*command)
            system("cmd");   /* have to fix this for win95 */
        else                     /* maybe i should use 'start' */
            system(command); /* programatically determine which */ 
    #endif                           /* system we are on, then make the  */
                     /* appropriate call */
    }


    Wie gesagt ich bekomm nur Unresolved external bei der Methode DoShellCommand(*char)

    vielen Dank für euere Hilfe
     

  2. #2
    deepthroat deepthroat ist offline Mitglied Diamant
    tutorials.de Premium-User
    Registriert seit
    Jun 2005
    Beiträge
    8.168
    Hi.

    Die DoShellCommand Methode hast du ja auch nicht implementiert. Du hast eine Funktion DoShellCommand definiert, die mit der ftp Klasse nichts zu tun hat.

    Die Definition müßte so aussehen:
    Code cpp:
    1
    2
    3
    
    void ftp::DoShellCommand( char *command ) {
      ...
    }
    Gruß
    Geändert von deepthroat (22.05.08 um 09:54 Uhr)
     
    If at first you don't succeed, try again. Then quit. No use being a damn fool about it.

  3. #3
    Avatar von devDevil
    devDevil devDevil ist offline Mitglied Platin
    Registriert seit
    Jun 2005
    Beiträge
    662
    Ich glaub er hat die Klasse nicht selbst geschrieben Sollte zu dem Unfug von Borland gehören.
     

  4. #4
    derNero derNero ist offline Rookie
    Registriert seit
    Nov 2006
    Beiträge
    8

    Super Danke.

    Nein die Klasse hab ich aus dem Netz. Wär mir nie aufgefallen das da ein ftp:: fehlt
     

Ähnliche Themen

  1. Unresolved external
    Von ComFreek im Forum Borland CBuilder und VCL
    Antworten: 2
    Letzter Beitrag: 26.07.09, 10:28
  2. Antworten: 0
    Letzter Beitrag: 02.02.08, 18:01
  3. linker fehler unresolved external
    Von woppa im Forum C/C++
    Antworten: 1
    Letzter Beitrag: 30.08.06, 08:42
  4. error LNK2019: unresolved external
    Von Nabi im Forum C/C++
    Antworten: 2
    Letzter Beitrag: 28.07.06, 11:21
  5. [Linker Fehler] Unresolved external
    Von Supa im Forum C/C++
    Antworten: 5
    Letzter Beitrag: 07.07.05, 12:23