How to migrate C++ to another project is what the question is. Thank you.
If code in your file doesn’t depend on other files, just copy the file (.h header and .cpp) to the target project and regenerate visual studio project files (if UE is installed from launcher, right click on .uproject file of the target project and select “Generate Visual Studio project files”), then recompile the project.
Yeah, but that doesn’t really answer my question.
I’m not talking 2 files, I’m talking 100 and over. You’re telling me to manually copy and paste each code one by one with compiling step which is practically impossible.
What prevents you from copying all the files at once?
In the “Shooter Game,” there are lot of C++ files, and you can’t copy and paste 100+ documents from there into another version. Otherwise, it’ll lag or gets you an extremely large bug. Try copy and paste C++ files from the game into another one without using “Add To Project.”
Literally, its called migration.
Well, if you’re bothered that you can introduce bugs or inefficiencies in the copied code, then why bother? Just write the code yourself from scratch
I found a very easy and quick solution, first of all copy the .h and .cpp files to the “Source” folder of the project, then open both files, and you have to replace only one line of code for each file and that’s it.
In the .h file, the line of code is searched for example “class MIGRATIONTEST_API UNewActorComponent: public UActorComponent” and it replaces “MIGRATIONTEST_API” by anyone who is in another file originally created in this project.
With the .cpp file is almost the same, the line of code to replace is for example #include
“MigrationTest.h”, once this is done just compile again and go.
The problem is that the migration does not work.
I migrated a blueprint together with its dependencies to another project. Most things were migrated successfully, but none of the cpp files (or basically anything from the “source” folder). Since some of the dependencies of my blueprint are cpp files, it does not work. So the migration failed, and I have to do it manually.
The problem with doing it manually is that I don’t immediately know which cpp files are dependencies I need, and which ones are unrelated.