Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

statische Funktion/Member-Variable

Empfohlene Antworten

Veröffentlicht

Hallo,

ich bekomme von GetFtpConnection einen Zeiger auf CFtpConnection.

CFtpConnection *connection; 

connection = session.GetFtpConnection(pstrServer, login, passwd, port, bPassive
Diese Funktion ist in einer Klasse implementiert. Ich möchte, dass zurückgegebene Zeiger auch für andere Funktionen außerhalb der Klasse verfügbar ist.Nun hatte ich gehofft dies ginge über eine statische Funktion/Member-Variable. Allerdings erhalte ich noch
error LNK2001: unresolved external symbol "public: static class CFtpConnection * Connect::connection_pointer" (?connection_pointer@Connect@@2PAVCFtpConnection@@A)
und
fatal error LNK1120: 1 unresolved externals
In Connect.cpp:
Connect::Connect(void)

{......

if(connection = session.GetFtpConnection(pstrServer, login, passwd, port, bPassive)) 

			{

			cout << "Verbindung wurde aufgebaut\n";     

			connection_pointer=connection; 

			}

CFtpConnection Connect::*connection_pointer=0;

....}

CFtpConnection Connect::*connection_pointer=0;

CFtpConnection * Connect::getLastConnection() 

{ 

	return connection_pointer; 

}

.....
In Connect.h
class Connect

{

public:

	Connect(void);

	static CFtpConnection * Connect::getLastConnection(); 

	static CFtpConnection *connection_pointer;

public:

	~Connect(void);

};

Die Zeile im Konstruktor:

CFtpConnection Connect::*connection_pointer=0;
raus. Die Zeile für die Deklaration:
CFtpConnection Connect::*connection_pointer=0;
ändern in:
CFtpConnection* Connect::connection_pointer=NULL;
[Editerle]
Du musst die statische Membervariable noch definieren, am besten in Connect.cpp:
CFtpConnection* Connect::connection_pointer;

Würde ich besser mit NULL definieren, sonst zeigt der Zeiger irgendwo hin. ;)

Jo danke, die Zeigerübergabe funktioniert glaube ich.:)

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.