Problems with my first c++ codes

Hi,

I’m getting started with UE4 and UE4 programming.
I have a basic to intermediate c++ experience background.
I followed the videos on how to get the source code from github and set up UE4.
I’ve also installed VisualStudio 2013 Express.

Now I’m following these two projects:
1- First Person Shooter C++ Tutorial:
https://wiki.unrealengine.com/First_Person_Shooter_C%2B%2B_Tutorial

2- HelloWorldPrinter Tutorial:
https://docs.unrealengine.com/latest/INT/Programming/QuickStart/index.html

I’m having the following problems (sorry if this is basic stuff but I’m just learning again after a long stop and now trying to catch up):

1- In both projects, inside the editor, when I go to ‘file’ -> ‘add code to project’ -> ‘Select Actor’ -> give it a name -> click ‘Create’ -> click ‘yes’ on the dialog that appears.
Problem: The project’s solution does NOT open, and I can’t edit the new class. I have to go to my projects folder and open the solution manually.

2- Inside the header file in the project solution; #include “HelloWorldPrinter.generated.h” has a red underline and the error message reads: Error: cannot open source file HelloWorldPrinter.generated.h for both projects

similar problem with GENERATED_UCLASS_BODY() (error:expected an identifier)
and multiple similar types of errors in the source (.cpp) file

3- When I build the project(s) I get the following error:
EXEC : error : Couldn’t find target rules file for target ‘BasicClassEditor’ in rules assembly ‘BasicClassEditorModuleRules, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null’.

Any help is appreciated…

Any idea guys?

I cant exactly answer your questions because a lot of things might be the answer.
1-It may be something about permissions maybe Editor is not permitted to open Vs ?
2 and 3 - It looks like there’s a problem about your installation because the default projects should compile unless you didnt change anything.

Thank you arkenthera for your response

For (1): I’ll look in the editor to see if there’s anything about permissions and/or setting up VS as the default editor
For (2): The only thing I did was during the process of creating the blank projects where I selected a different projects folder destination and had them save to my d: drive where the engine is located.

Navigate to your visual studio folder and check its permissions at the security tab in the properties.It may be it.or UAC maybe?

Didn’t work. Still having the same issue. Nothing is compiling or working for me. I’m thinking removing all projects and UE4 and do a clean install.

This is so frustrating…I removed UE4 completely. Reinstalled and followed documentation and video tutorial step by step and still can’t edit the class code after adding it in the editor and when I manually open the solution I find it unable to identify all required headers and files like (className.generated.h) and macros (UCLASS, GENERATED_UCLASS_BODY)…etc

Do these errors actually happen when you try and build the projects? Sometimes the intellisense is just stupid and doesn’t pick up certain things until you try and build. Also, are you using any other VS environments on your computer?

Pretty sure the Express version of VS cannot be opened by external applications, you need Professional or Ultimate.
The generated.h files dont exist in the beginning. They will get generated by the macros during the compilation, just ignore the error and build the project, it should work just fine.

It can be.

Thank you guys

They happen as soon as I open the solution and the header file. For projects that were saved in the default "c:\documents\unreal projects", building and rebuilding couple of times actually helped and errors disappeared. But for projects that were saved in “D:\GitHub\UnrealEngine\Unreal Projects” when they were created, building and rebuilding never solved the problem and errors still exist. I can’t just keep creating projects in my c: drive. it’s almost full now. BTW, all UE4 engine files are in my d: drive. The only thing that was automatically created in c: was the unreal projects folder.

Thanks for the VS Express info.! That’s probably why it’s not opening.
As mentioned above, building projects that are not in the default ‘c:\documents\unreal projects’ folder never works.

I was horribly confused by this at first, hah.
This always happens when you add a new class with the menu, you need to close the editor and rebuild the solution so it creates the generated header file.

It opens express for me just fine.

Thank you

Does that work for projects created outside the default “c:\documents\unreal projects” folder? I point my newly created projects to point to my d: drive and it never compiles and the errors remain no matter how many times I rebuild.

Any setting change I need to make to my UE4 editor? I installed three time and still doesn’t open.

Well it does for me, considering my projects are located in D:\Unreal Projects as my C: drive would get full too fast.

Worth noting that intellisense takes forever to parse the project and that it shows errors until it finished doing that.

When I go to “file->project->open visual studio” I get the following message:

“Could not open Visual Studio 2013 for project D:/GitHub/Unreal Projects/test/test.sln”

I had a very similar issue. In the end I deleted my unreal folder completely, used the Launcher (Blue Icon) and downloaded the engine with it, then I had to use the “verify install” option under “Launch”. That solved my issue. Afterwards I can use the Github version and everything works 100%

You can take a look here: https://answers.unrealengine.com/questions/13425/could-not-open-visual-studio-2013-for-project-cunr.html

Thank you Ad3ViLl

I had UE4 installed and then removed it. I only kept the compiled UE4 from source code. Right now the launcher doesn’t have the ‘verify install’ button since UE4 is not actually installed.

I guess you’re saying:
1- I remove the source folder and the compiled UE4 first
2- Download and Install UE4 using the just the launcher and nothing else.
3- Use verify install under Launch
4- Clone the source code from github, compile, and start working with the compiled version (not the installed version).

Are those the correct steps I need to take? Do I need to mess with the environment variables (which I already did and nothing changed) ?

Also, does it matter where I install my UE4 (c: vs d:) ?

That’s correct. That’s how I got mine to work. Hopefully it will work for you too.

Here’s what I did:

1- Installed UE4 launcher from UE4 download page.
2- From the launcher, downloaded and installed UE4
3- I clicked on verify installation under Launch
4- downloaded and compiled the github source code version
both versions are installed in d: drive.

Here’s what I’m seeing:
1- When launching UE4 from the launcher by clicking on the “Launch” button:
a- adding a new class will actually open my visual studio2013 express.
b- Clicking on ‘file->open visual studio’ will also open VS2013 express
c- After the file opens in VS2013 express, all I see is the new class code. There are zero UE4 source files or folders.

2- When launching UE4 manually using the compiled source version in “\UnrealEngine\Engine\Binaries\Win64\UE4Editor”;
a- Adding a new class will not open VS2013 express
b- Clicking on file->open visual studio will not open VS2013 express and I still get the error message “Could not open Visual Studio 2013 for project D:/GitHub/UnrealEngine/UE4.sln”
c- by opening the project solution file manually in VS2013 express, I can see all the engine source code along with the project code under the ‘game’ stanza.

Really confused now…which version should I use for development:
1- The one that was installed via the launcher that opens VS2013 but will only show project code without UE4 source code?..or
2- The compiled github version found in “\UnrealEngine\Engine\Binaries\Win64\UE4Editor” which doesn’t open VS2013 express but if opened manually will include all UE4 source code?

You can use the Launcher version, add you code, compile the solution, then close Visual Studio and open your Project’s solution file (Myproject.sln located in your project’s root folder). That works for me, it open your project in VS with both your Game and the UE4 code.