Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can we have Hot Reload or Live coding for C++ based apps ?
Forum Updated to NodeBB v4.3 + New Features

Can we have Hot Reload or Live coding for C++ based apps ?

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 4 Posters 1.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tataeress
    wrote on last edited by tataeress
    #1

    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 ?

    JonBJ Chris KawaC 2 Replies Last reply
    1
    • T tataeress

      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 ?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @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....

      1 Reply Last reply
      0
      • T tataeress

        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 ?

        Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @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.

        T 1 Reply Last reply
        1
        • Chris KawaC Chris Kawa

          @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.

          T Offline
          T Offline
          tataeress
          wrote on last edited by tataeress
          #4

          @Chris-Kawa I tried, but it doesn't work
          The hot reload button just does nothing

          Chris KawaC 1 Reply Last reply
          0
          • T tataeress

            @Chris-Kawa I tried, but it doesn't work
            The hot reload button just does nothing

            Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @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?

            T 1 Reply Last reply
            1
            • Chris KawaC Chris Kawa

              @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?

              T Offline
              T Offline
              tataeress
              wrote on last edited by
              #6

              @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!

              T 1 Reply Last reply
              0
              • T tataeress

                @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!

                T Offline
                T Offline
                tataeress
                wrote on last edited by
                #7

                @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 ..

                Chris KawaC 1 Reply Last reply
                0
                • T tataeress

                  @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 ..

                  Chris KawaC Offline
                  Chris KawaC Offline
                  Chris Kawa
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @tataeress Start with a basic wizard generated widgets app and test if that works for you.

                  T 1 Reply Last reply
                  0
                  • Chris KawaC Chris Kawa

                    @tataeress Start with a basic wizard generated widgets app and test if that works for you.

                    T Offline
                    T Offline
                    tataeress
                    wrote on last edited by tataeress
                    #9

                    @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!

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      Stefan Reinalter
                      wrote on last edited by
                      #10

                      On Windows, you can license Live++: https://liveplusplus.tech

                      1 Reply Last reply
                      1

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved