Announcement

Collapse
No announcement yet.

Visual Studio Code error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Visual Studio Code error

    Click image for larger version

Name:	VS2017.jpg
Views:	1
Size:	243.8 KB
ID:	1226535

    Hello, I start in C ++ in unreal with VS2017. But VS2017 does not accept some code :s
    I do not know what to do.
    I went into the file "edit" "preference" and took vs2017.
    Attached Files

    #2
    Do you get an error when you try to compile? because Visual Studio doesn't understand a lot of UE4 code and so has the red squiggly lines a lot that aren't problems - try to compile
    Every day I beat my own previous record for the number of days I've stayed alive!

    Comment


      #3
      Try adding the header:

      Runtime/Engine/Classes/Components/BoxComponent.h
      SolidGasGames

      Comment


        #4
        Of course you need to include the headers for classes you're using.
        in your *.h file add the following line (before your own class) :

        Code:
        class UBoxComponent;
        This is a forward declaration (you should not include headers in your own .h when it's not necessary)

        in your *.cpp, add the following line:
        Code:
        #include "Runtime/Engine/Classes/Components/BoxComponent.h"
        This is your actual include which makes your cpp "ready" to use external classes.

        Comment


          #5
          Hi,
          my VS2017 It says: unable to open the source files for the
          #include "Runtime/Engine/Classes/Components/BoxComponent.h"
          and yes, the error is there when i try to compile

          Comment


            #6
            The include is incorrect, try this :
            Code:
            #include "Components/BoxComponent.h"
            And the forward declaration in the header is not for the UBoxComponent, but the UShapeComponent
            Last edited by Thesus; 08-20-2017, 03:00 PM.

            Comment


              #7
              people acting like everyone knows that Epic changed the system to include what you use... MinimalCore ... RIP Engine.h... You're probably going to need to add staticmeshcomponent.h as well, although I'm not sure what is in CoreMinimal or Actor.h :/

              Edit: also you have a UShapeComponent as variable root in your header, wouldn't it be better to be a UBoxComponent? I know UBoxComponent inherits from UShapeComponent but I guess it depends what you're doing.
              Last edited by StaffOnlyStudio; 08-20-2017, 07:49 PM.

              Comment

              Working...
              X