Can we have Hot Reload or Live coding for C++ based apps ?
-
Hi,
I've noticed that we have Qml live coding for years now as well as for QML based apps that uses components written in C++.
also, there are game engines like Unreal that support hot reload and I was thinking..
Why can't we code apps in C++ only with Qt Widgets for example, but, with live coding / hot reload ? -
Hi,
I've noticed that we have Qml live coding for years now as well as for QML based apps that uses components written in C++.
also, there are game engines like Unreal that support hot reload and I was thinking..
Why can't we code apps in C++ only with Qt Widgets for example, but, with live coding / hot reload ?@tataeress
What do your other IDE's do for "live coding / hot reload" in the context of a C++ (compiled) program?
I would hate to think it does some kind of re-compile/link every time I change a character in a header file.... -
Hi,
I've noticed that we have Qml live coding for years now as well as for QML based apps that uses components written in C++.
also, there are game engines like Unreal that support hot reload and I was thinking..
Why can't we code apps in C++ only with Qt Widgets for example, but, with live coding / hot reload ?@tataeress said:
Why can't we code apps in C++ only with Qt Widgets for example, but, with live coding / hot reload ?
You can. You just need an IDE that supports it. For example you can hot reload widgets app in VS2022 with no problem.
-
@tataeress said:
Why can't we code apps in C++ only with Qt Widgets for example, but, with live coding / hot reload ?
You can. You just need an IDE that supports it. For example you can hot reload widgets app in VS2022 with no problem.
@Chris-Kawa I tried, but it doesn't work
The hot reload button just does nothing -
@Chris-Kawa I tried, but it doesn't work
The hot reload button just does nothing@tataeress I just tried and it works ok. Added a function call, changed some parameters around, modified member values etc.
Not all types of changes are supported: Supported Code Changes (C++).
What kind of chang are you trying to make for example? -
@tataeress I just tried and it works ok. Added a function call, changed some parameters around, modified member values etc.
Not all types of changes are supported: Supported Code Changes (C++).
What kind of chang are you trying to make for example?@Chris-Kawa oh right, my changes were within the static library that contains all the code of the app since I wanted to make it easy to do unit tests also.
And I'm making the app executable using htat static library that has all the code
According to the documentation you linked, I can't make changes to a static library and expect hot reloading to work xD
Thx a lot! -
@Chris-Kawa oh right, my changes were within the static library that contains all the code of the app since I wanted to make it easy to do unit tests also.
And I'm making the app executable using htat static library that has all the code
According to the documentation you linked, I can't make changes to a static library and expect hot reloading to work xD
Thx a lot!@tataeress Actually changing the app from a library linked to a main.cpp executable to a full executable, whatever I change in code nothing happens at all
I changed code in main.cpp, modifying the app's main class constructor, slots .. added new functions, modified variables ..
its all getting ignored .. -
@tataeress Actually changing the app from a library linked to a main.cpp executable to a full executable, whatever I change in code nothing happens at all
I changed code in main.cpp, modifying the app's main class constructor, slots .. added new functions, modified variables ..
its all getting ignored ..@tataeress Start with a basic wizard generated widgets app and test if that works for you.
-
@tataeress Start with a basic wizard generated widgets app and test if that works for you.
@Chris-Kawa
Actually it worked once I did:- Switch to RelWithDebugInfo instead of Release mod
- Go to the Project Properties > C/C++ > General > Debug Information Format and chose
Program Database for Edit And Continue
- Replace qt_add_executable in my CMakeLists.txt to add_executable while keeping the same arguments
- Added this before the add_executable
if (MSVC AND WIN32 AND NOT MSVC_VERSION VERSION_LESS 142) add_link_options($<$<CONFIG:RelWithDebugInfo>:/INCREMENTAL>) add_compile_options($<$<CONFIG:RelWithDebugInfo>:/ZI>) endif()
Thx a lot!
-
On Windows, you can license Live++: https://liveplusplus.tech