x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

UCameraComponent is Undefined

I'm learning UE through this tutorial: https://docs.unrealengine.com/en-US/Programming/Tutorials/PlayerInput/1

There is a line of code from the first part that Visual Studio is not recognizing:

UCameraComponent* OurCamera = CreateDefaultSubobject(TEXT("OurCamera"));

 Severity    Code    Description    Project    File    Line    Suppression State
 Error (active)    E0020    identifier "UCameraComponent" is undefined    HowTo_PlayerInput     C:/pathto/MyPawn.cpp,    18

  1. I think that im missing a #include statement for "UCameraComponent" but I have no idea what file i would need to include.

  2. If i am correct does this mean i should expect some of the tutorials to be completely outdated or just missing some small changes?

  3. Is there documentation I could search for UE's classes and what files they are located in?

Product Version: UE 4.21
Tags:
more ▼

asked Feb 07 '19 at 02:02 AM in C++ Programming

avatar image

Corruptblack
8 1 3

avatar image Corruptblack Feb 07 '19 at 01:14 PM
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

You should look API reference just search class name in doc search or google (add "UE4" if it does not pop up)

https://api.unrealengine.com/INT/API/Runtime/Engine/Camera/UCameraComponent/index.html

In below you have the info:

-In which module class is located, you need to add module to dependencies in *.build.cs of your module if you gonna use the class, or else you will get linker errors

-Header file, UBT automatically configure include paths, so only part of path you need to include is after either "Classes" or "Public" directory. So i case of UCameraComponent is this bolded part:

Runtime/Engine/Classes/Camera/CameraComponent.h

more ▼

answered Feb 07 '19 at 02:09 AM

avatar image

Shadowriver
37.8k 937 172 1123

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

The tutorial forgot to include

include "Camera/CameraComponent.h"

In MyPawn.cpp

I caught this watching

https://www.youtube.com/watch?v=vQsOIGWRdXQ

more ▼

answered Feb 25 '19 at 02:04 PM

avatar image

froots
1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question