I have added a few functions to tracktion_engine::TracktionThumbnail, and now my compiler throws a class type redefinition error:
You can reproduce this error by adding a public function to the tracktion_engine::TracktionThumbnail class while using RecordingDemo example.
It should be no problem to add a function to a class. I can do that to RecordingDemo with no errors.
The class redefinition error suggests something else is going on. I guess it could be a number of things. Off the top of my head: Did you by any chance add something like
class TracktionThumbnail ... anywhere? Or did you include the tracktion_TracktionThumbnail.h directly in your own code (it’s not header guarded so that would probably give a class redef error)? Or maybe some other typo or mistake in the code you added?
Can you show exactly what you’re adding?
When you say you “added a few functions” did you modify the file or create a copy of it?
Either way, as @chrhaase says, you’ve probably included the file or defined it multiple times.
Hey @dave96 and @chrhaase! Thanks for getting back to me.
@dave96 I modified the file in Visual Studio 2019.
When I first saw the error I thought of what @chrhaase suggested. However, my steps to reproduce the error are to pull the master branch of tracktion_engine, generate the examples, open RecordingDemo in Visual Studio 2019, and add the following function to tracktion_Thumbnail.h and tracktion_Thumbnail.cpp respectively:
float test(int val);
float TracktionThumbnail::test(int val)
I then try to build and get the error I stated above.
Hmm. And it does indeed build if you don’t add anything?
Yes. It builds when l don’t add anything.
Okay! I solved the problem. I was using Visual Studio’s generate definition command with Quick Actions and Refactorings. This generated a #include “tracktion_Thumbnail.h” at the top of tracktion_Thumbnail.cpp.