Skip to content

ppu-g++ compile std::thread #7

@humbertodias

Description

@humbertodias

Trying to compile std::thread

docker run -i --rm zeldin/ps3dev-docker bash -s <<EOF
echo '#include <iostream>
#include <thread>

// Function to be executed by the thread
void threadFunction(int threadID) {
    std::cout << "Thread " << threadID << " is executing" << std::endl;
}

int main() {
    // Creating a thread and passing a function to execute
    std::thread t1(threadFunction, 1);

    // Joining the thread to the main thread
    t1.join();

    // Output a message from the main thread
    std::cout << "Main thread is executing" << std::endl;

    return 0;
}' > oo.cpp
ppu-g++ oo.cpp -o oo -std=c++11
EOF

output

oo.cpp: In function 'int main()':
oo.cpp:11:10: error: 'thread' is not a member of 'std'
     std::thread t1(threadFunction, 1);
          ^~~~~~
oo.cpp:11:10: note: suggested alternative: 'tera'
     std::thread t1(threadFunction, 1);
          ^~~~~~
          tera
oo.cpp:14:5: error: 't1' was not declared in this scope
     t1.join();
     ^~
oo.cpp:14:5: note: suggested alternative: 'tm'
     t1.join();
     ^~
     tm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions