Download

Compiling the right way

related to this post
https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1768222-unreal-says-compile-completed-but-it-still-uses-the-old-code

Im using ue 4.24.3 & msvc 2019
This has been driving me nuts for the last 2 months. I don’t use blueprints much

What are the exact steps I need to follow to compile a program everytime without fail. I dont care if compiling takes 10x as long, I just want it to work 100% of the time.

I use ctrl-shift-b in msvc and it saiz it has compiled, only for me to find out sometimes ~5% of the time it still uses an old version in the editor
I press the build button in the editor it saiz compile completed, only for it to sometimes still use an old version.
If I first build in MSVC and then compile afterwards in the editor that has a higher success rate but its still not foolproof.
I have tried live coding also but that also is not guaranteed to work.

I have wasted hours on this, can someone please explain the necessary steps thanks

Based on your other post - Hot Reload hasn’t really worked properly or been stable for several versions now, it’s not worth the trouble and you should avoid it. Most of us are using the “experimental” Live Coding now, which you can easily enable. It’s ten times faster, and much more stable and reliable.

Make sure you save the files before recompiling them. Any Header (.h) or Constructor changes require a full restart. You can do that by just hitting “relaunch” in visual studio.

OK thanks mate, So Live Coding is the desired way to go.
I will stick with that then if thats the expected way to do it, Its still not ideal though for a few reasons

I have to save all files before I press ctril-alt-F11,
Any errors I can’t click on and be taken to the relative part of the code,
the Popup Window is annoying, not integrated into msvc
I don’t see any ‘relaunch’ command in msvc.
I’ve been using msvc since msvc 1.0 in 1993, this is the first time I have to restart the IDE after making changes to a header etc. I can see this getting tiring extremely quickly
thanks again

Both Live Coding and Hot Reload are designed for small interative changes, neither were designed to allow full recompilation inside the editor AFAIK.

It’s probably worth pointing out here that Unreal has a much more complex build process than simply invoking MSVC, and has to build through it’s own tools. Header changes for reflected types can’t be made partly because it requires invoking UHT to parse and create generated code for reflection.

This isn’t my area of expertise, but as I understand it it’s also extremely difficult to change the memory layout of an object then hot-reload it straight back in. That’s why header/constructor changes to classes which have already been put in memory don’t work, or can at the very least cause data corruption. That’s just my understanding of it, but people smarter than me would be able to tell you why :smiley: