Warum erhalte ich beim Erstellen eines Threads für diese Funktion eine Fehlermeldung? [Duplikat]

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Warum erhalte ich beim Erstellen eines Threads für diese Funktion eine Fehlermeldung? [Duplikat]

by Guest » 16 Jan 2025, 07:07

Ich habe eine Funktion erstellt, die im Laufe der Zeit einen String ausliest. Es funktioniert gut, wenn Sie es alleine aufrufen, aber wenn ich versuche, einen neuen Thread für die Funktion zu erstellen, erhalte ich viele Fehler. Eine andere Grundfunktion funktioniert jedoch einwandfrei.

Code: Select all

void talk(std::string& string)
{
for (volatile int i{0}; i < string.length(); ++i)
{
if (string[i] != '\n')
{
if (i > 0 && string[i - 1] == '\n') std::cout &), std::__cxx11::basic_string, std::allocator > > >’
258 |           _M_invoke(_Index_tuple)
|           ^~~~~~~~~
/usr/include/c++/11/bits/std_thread.h:262:9: error: no type named ‘type’ in ‘struct std::thread::_Invoker, std::allocator >&), std::__cxx11::basic_string, std::allocator > > >::__result, std::allocator >&), std::__cxx11::basic_string, std::allocator > > >’
262 |         operator()()
|         ^~~~~~~~

Top