Unresolved external

derNero

Grünschnabel
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::DoShellCommand(char *)' referenced from C:\PROGRAM FILES\BORLAND\BCC55\BIN\CSV2CMX1.2.OBJ

Programm:
Code:
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:
#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:
#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
 
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:
C++:
void ftp::DoShellCommand( char *command ) {
  ...
}
Gruß
 
Zuletzt bearbeitet:
Zurück