0
\$\begingroup\$

I've just started a brand new project and created a created a new C++ Character class. However Visual Studio 2017 shows 140 errors. The project still builds fine, however the syntax highlighting and errors are very intrusive.

Here are some examples of the errors:

on the BaseCharacter.cpp class I just created:
class "UObject" has no member "BeginPlay"
class "UObject" has no member "Tick"
class "UObject" has no member "SetUpPlayerInputComponent"

on multiple '.h' files:
this declaration has no storage class or type specifier

for all '*.generated.h' files:
cannot open source file "[ClassName].generated.h"

Is this a problem with my intellisence or the project itself? I haven't changed any of the code that was generated by Unreal.

\$\endgroup\$
  • \$\begingroup\$ Welcome to the Game Dev Stack Exchange. The easier to make it to read your question, the easier it is for others to answer. If you're listing multiple errors, please break them up in some way that allows other to tell where one error end & another starts. Also, using the ` character at the beginning & end of inline code will apply code formatting. \$\endgroup\$ – Pikalek Nov 12 '18 at 2:13
1
\$\begingroup\$

If you go to your Unreal Engine launcher and click the drop down arrow next to your installed engine version, one of the check boxes you could enable for your UE4 build is the "C++ Symbols". If you check that box, it'll download a lot of stuff but for situations like this it'll really help out.

There are many tabs at the bottom of the Visual Studio window when you try to compile and build the project. One of them is the "Call Stack", and if you have those C++ Symbols installed then it will give you all sorts of extra details about what exactly is going wrong so that you can see exactly what the problem is.

As for the actual error message you're getting, it looks like your BaseCharacter.cpp file has a : public UObject as it's parent for some reason near the top of the file? If so, you might want to replace that with : public ABaseCharacter and then it should work fine.

Here's an example of how that line should look in the .h header file:

class ATP_FirstPersonCharacter : public ACharacter
\$\endgroup\$
1
\$\begingroup\$

This has been a problem in the Unreal world for a while now. However, recently things have been getting a little better. This solution worked for me.

Workaround:
1. Open the project solution
2. Inside Visual Studio go to Project -> Properties
3. In configuration select "All Configurations"
4. In the Configuration Properties tree select NMake
5. Click the dropdown for the "Include Search Path" item and select "Edit..."
6. Click the "New Line" button at the top right of the window and add this path "..\Build\Win64\UE4Editor\Inc\YourModuleName" without the quotes.
7. Repeat step 6 for each c++ module in your project

However there are still sometimes when errors show up and the code compiles just fine. Its no where near how bad it was before though. Another option, that I'm not fond of is disabling intellisense completely but I don't like that option as it slows down development a lot.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.