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.

std::string zu System::String - Problem

Empfohlene Antworten

Hallo,

ich versuche mich an einen C++ Projekt (Visual Studion 2008, CLR-Projekt) und haben mitlerweile eine Klasse geschrieben die so einwandfrei funktioniert und diese kann ich auch ohne größere Probleme benutzen. Nun aber stecke ich in einen Fehler fest, bei den ich einfach nicht weiterkomme. Habe schon stundenlange gesucht und nichts gefunden und ärgere mich nur noch grün und blau, also:

Ich habe eine ganz einfache Funktion, die mir in einen Textfeld was reinschreiben soll:


private: System::Void test_button_Click(System::Object^  sender, System::EventArgs^  e) 

{

	std::string test;

	test = "test";

	//test = TestObjekt.TestFunktion();

	TestBox->Text = gcnew String(test.c_str());

}

das funktioniert auch so, solange ich nicht versuche den Text aus der Funktion des Objektes an die Variabel zu übergeben. Wenn ich das mache, kommen 2 Link Fehler und da stecke ich fest: error LNK2028: Nicht aufgelöstes Token (0A000017) error LNK2019: Verweis auf nicht aufgelöstes externes Symbol die noch aufgerufene Funktion:

std::string TestFunktion()

{


	std::string test;

	test = "test";

	return test;


};

EDIT: Kann durchaus sein, dass ich mich gerade im Forum-Bereich verirrt habe, wenn das so ist: Sorry

Bearbeitet von tallman

die noch aufgerufene Funktion:


std::string TestFunktion()
{

std::string test;
test = "test";
return test;

};
[/CODE]

Wenn das nicht gerade innerhalb der Klassendefinition steht, sollte da [b]std::string [color=DarkRed]TestKlasse::[/color]TestFunktion()[/b] stehen.

Das Semikolon am Ende ist übrigens nicht notwendig ;)

EDIT: Kann durchaus sein, dass ich mich gerade im Forum-Bereich verirrt habe, wenn das so ist: Sorry
Macht nicht, hab's schon verschoben :)

Oh man, ich bin echt n runde dämmlich :upps

Vielen danke, genau das war es...

mfg

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.