Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
humbertodias opened this issue Mar 8, 2024 · 0 comments
Open

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

humbertodias opened this issue Mar 8, 2024 · 0 comments

Comments

@humbertodias
Copy link

humbertodias commented Mar 8, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant