Include not working! D:

Hello!

In my project, i have added some additional classes in their own files, but when i try to include them, i get this compilation error


Error c:\users\edwin\documents\unreal projects	pexample\source	pexample\Enemy.h(7) : fatal error C1083: Cannot open include file: 'UNN.h': No such file or directory


It is in the same directory, and i’ve searched around the issue, but have found no answers!

Here is my VS window:

What can i do?

Try to " Generate Visual Studio Project Files "

I couldn’t find it, so i selected ‘refresh vs project’ and my classes are gone!

Edit, i’ve found them in my file browser, it just removed them from my solution explorer. Still not working

To generate your Visual Studio project files, just right click your .uproject file! the option should be right there!

Found the option, but it has made 0 difference.
:mad:

It also removed all my classes

Are you able to include other classes?
If other classes work try this, create a new class and copy the code from the one that doesn’t work and then include the new one.

Edit: Also name it something else and try with the lowercase letters.

Don’t you have to delete your binary files as well, when you generate? Also, even if it removed all of your classes, the files are still there.

Where are your files located physically? UE4 doesn’t care about your solution - that’s just for your viewing convenience. Show us where those new files of yours are in Windows Explorer.

DW about my classes, i can still find them in my file explorer. It must have just moved them.

Blue Man, i’ll try making the classes within UE4, lets see if that works.

EDIT: YES it at least tries to compile them and the include works. TY.

BUT…

THey have been included, but the classes within the header files aren’t being recognised…

I am getting a HUGE compile error, because it doesn’t recognise my type identifiers:



c:\users\edwin\documents\unreal projects	pexample\source	pexample\UNN.h(13): error C4430: missing type specifier - int assumed. Note: C++ does not support default-intc:\users\edwin\documents\unreal projects	pexample\source	pexample\Connector.h(12): error C2143: syntax error: missing ';' before '*'


What’s going on?

When you add new .h/.cpp files. It automatically wants to place them in your Intermediates folder (or whatever its called) so if u didnt move them thats where they are and why u cant include them. Doesnt matter where they show in the solution explorer as thats just a visual organiser.

As for your issue with int. Don’t use the builtin integer types. Use int32, uint32, int16, uint16, int8, uint8 instead.

Thanks, the classes weren’t in the source file, so i moved them from intermediate.

I have no issue with int, the problem is that something is stopping it from being able to recognise my type identifiers, so it is assuming them as ints! I don’t know why my classes aren’t being defined tho…

Ah my bad, im on my phone so couldnt read the whole xode block. Once ur .h/.cpp have been moved and u include the .h then the class undefined issue should technically resolve itself.

It still doesn’t work :frowning: i get the same error

Can you show us the header file?

I believe this has happened to me several times. Try to build your project, save it, and then re-open Visual Studio.

Not sure why this worked for me, seemed to solve the problem though.

This makes me want to cry. I have the .cpp and .h files I added in the source folder. I had VS add them to the project. I tried building and got the same “defies common sense” error and then tried saving/closing/opening/rebuilding strategy and the same error occurs.

I am using UE4.22.3 and VS 2017 Express (Community edition is not an option for my company due to license issues)