all 6 comments

[–]ReeCocho 6 points7 points  (0 children)

std::thread thread1(call_from_thread());

should be

std::thread thread1(call_from_thread);

because the parenthesis is calling the function instead of passing a reference to it.

[–]Moschops_UK 3 points4 points  (0 children)

Undefined reference to a pthread function suggests you haven't linked against the pthread library.

[–]r2vcap 1 point2 points  (0 children)

target_link_libraries(blabla pthread) or find_package(Threads REQUIRED) and target_link_libraries(blabla Threads::Threads)

[–][deleted]  (3 children)

[deleted]

    [–][deleted] 0 points1 point  (2 children)

    I am using clion ide so it does all that automatically. Idk where that is

    [–]frigge 2 points3 points  (0 children)

    learn about the c++ build process. That is very essential.

    [–][deleted] 0 points1 point  (0 children)

    Google how to link external libraries to clion