Skip to content
New issue

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

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

Already on GitHub? # to your account

i can`t use x86_64-w64-mingw32-g++ build the project in the linux #920

Open
li-yun-xian opened this issue Aug 17, 2024 · 3 comments
Open

Comments

@li-yun-xian
Copy link

main.cpp: In function ‘int main(int, char**)’:
main.cpp:5:10: error: ‘mutex’ is not a member of ‘std’
5 | std::mutex s;
| ^~~~~
main.cpp:2:1: note: ‘std::mutex’ is defined in header ‘’; did you forget to ‘#include ’?
1 | #include
+++ |+#include

@ArthurSonzogni
Copy link
Owner

Hello,
Could you please provide the steps to reproduce?

@li-yun-xian
Copy link
Author

li-yun-xian commented Aug 20, 2024

i create a toolchain.cmake file for cmake to build it

toolchaim.cmake 👇
`
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)

set(TOOLCHAIN_PREFIX x86_64-w64-mingw32)

set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++)

`

Then enter the following two commands
cmake -S .. -B build -DCMAKE_TOOLCHAIN_FILE=./toolchain.cmake
cmake --build build --target all

if i include mutex in other program and use mingw compile it ,will occur the same error,linux mingw maybe not support mutex

@cole-io
Copy link
Contributor

cole-io commented Aug 23, 2024

Are you compiling with --std=c++23?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants