Simple Linker Error

I’m afraid you put those new files into the wrong place. The /Intermediate/ directory is meant for temporary files created by the compiler. Your new files should be added to a module in the /Source/ directory tree instead. To get up and running quickly, you can simply add them to an existing module. Later on you will probably want to create your own module.

Most modules have the following structure:

/ModuleName/Private - contains .h and .cpp files that are private to your implementation and should not be visible to other modules

/ModuleName/Public - contains .h files that can be used in other modules

Okay, I followed the Getting Started programming tutorial from the documentation and decided to see if I could create a simple C++ class that can be accessed from one of the pre-created UE4 classes. I Right clicked my project in VS solution explorer and added a CVector3.h and CVector3.cpp.

It put these files in “\Unreal Projects\MyProject\Intermediate\ProjectFiles” so in my Actor.cpp from the tutorial, I added #include “…/…/Intermediate/ProjectFiles/CVector3.h” which works correctly and intellisense picks up the funciton definitions. However, when I try to call one of my functions defined in the CVector3.cpp, it throws me a linker error (LNK 2019), as though it is not aware that the function definition exists.

I have correctly included the header: #include “CVector3.h” in the cpp aswell and it picks up the CVector3 class from intellisense here aswell. Am I just doing something stupid or does UE4 generate some dependencies which means I can’t use a simple header/cpp file?

Added the file into the Source/MyProject folder where the other pre-generated code was,rather then copying/pasting the files there and it worked great, thanks!