Skip to content

Commit 4e9d79d

Browse files
OlivierLDffBe-ing
authored andcommitted
cxx-qt-gen: add a note about bug with msvc when compiling in debug
This provide a workaround for users that want to build their code in Debug mode fix
1 parent c0a7819 commit 4e9d79d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

book/src/getting-started/4-cmake-integration.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ $ build/examples/qml_minimal/example_qml_minimal
116116

117117
You should now see the two Labels that display the state of our `MyObject`, as well as the two buttons to call our two Rust functions.
118118

119+
### Windows with MSVC
120+
121+
If you're building CXX-Qt on Windows using MSVC generator, you need to add the `-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL` flag to the cmake command when building with the `Debug` configuration. This flag is necessary to ensure that the correct C Runtime Library is used. Then you can build using `cmake --build build --config Debug`.
122+
123+
This issue is caused by a bug in the [cc](https://docs.rs/cc/latest/cc/index.html) crate (as described in https://github.com/rust-lang/cc-rs/pull/717), which has not been merged yet. Specifically, the problem is that cc generated code always links to the MultiThreaded runtime, even when building in Debug mode. We hope that this step won't be necessary in the future, once the cc crate fix is merged and released.
124+
119125
## Success 🥳
120126

121127
For further reading, you can take a look at the [QObject chapter](../qobject/index.md) which goes into detail about all features that CXX-Qt exposes to new QObject subclasses.

0 commit comments

Comments
 (0)