Include statement error, Auto complete and Variable colors

My code works but a few things bug me that I can’t figure out how to fix.

-The red squiggles under the include statements. I remember the instructor saying that this wasn’t a big deal but it annoys me and I think it might be causing other problems.

-Visual Studio Code doesn’t auto-complete my variable names such as HiddenWord or Lives, however, if I create a new variable on the .cpp page it will auto-complete as long as I am still on the same page.

-Also in the instructors’ header file int32 and FString are an aqua color whereas in mine they are just white and when I hover over Lives or HiddenWord it just says " HiddenWord"

-The last thing is the color of my variables is different than the instructors but only sometimes, for example, when doing “++Lives” it is white but when I do “HiddenWord.Len()” the HiddenWord part is light blue

I am running the most recent version of Visual Studio Code and am using the Dark plus theme

Screen Shot 2020-05-29 at 12.00.42 PM

It is because of a bug in UE4.25. Try downgrading to UE4.24 and the errors will go away.

Have you followed these steps?

Thanks!! That definitely helped! I am however still experiencing an include error. I think it has to do with the part where you replace some of the text with your projects name. I am currently working on the Bull Cow Game and as far as I can tell my project name and the name the folder I am working in are different, (I think that the project name is “BullCowGame” and the folder is “BullCowGame-starter-kit”). I have tried both of these and some combinations but none of them have worked so far.

Don’t know why this would still not work, have you compiles after making the changes?

Yes, I did compile after saving and making the changes then restarted visual studio code and still had the include errors.

It still might be running the old code somehow. Try and delete the Intermediate and Binaries folder and rebuild to manually force it to compile new code. I highly suggest you to take a backup of your project before doing so.

Unfortunately this didn’t work either

@sampattuzzi, you seem to be only providing Windows specific defines. Do you have a mac and/or Linux machine to get these?

I don’t. If somebody does have a Linux or Mac, please:

  1. Create a project in 4.24
  2. Generate a VSCode project
  3. Copy the contents of the defines
  4. Paste them here.

Then I should be able to upload files for those too.

I am using a Mac and this is what my defines for 4.24.3 was, when I pasted it into my bull cow game project and changed the project name it caused some other problems though.

"defines": [
    "IS_PROGRAM=0",
    "UE_EDITOR=1",
    "HAS_METAL=1",
    "ENABLE_PGO_PROFILE=0",
    "USE_VORBIS_FOR_STREAMING=1",
    "USE_XMA2_FOR_STREAMING=1",
    "WITH_DEV_AUTOMATION_TESTS=1",
    "WITH_PERF_AUTOMATION_TESTS=1",
    "UNICODE",
    "_UNICODE",
    "__UNREAL__",
    "IS_MONOLITHIC=0",
    "WITH_ENGINE=1",
    "WITH_UNREAL_DEVELOPER_TOOLS=1",
    "WITH_APPLICATION_CORE=1",
    "WITH_COREUOBJECT=1",
    "USE_STATS_WITHOUT_ENGINE=0",
    "WITH_PLUGIN_SUPPORT=0",
    "WITH_ACCESSIBILITY=1",
    "WITH_PERFCOUNTERS=1",
    "USE_LOGGING_IN_SHIPPING=0",
    "WITH_LOGGING_TO_MEMORY=0",
    "USE_CACHE_FREED_OS_ALLOCS=1",
    "USE_CHECKS_IN_SHIPPING=0",
    "WITH_EDITOR=1",
    "WITH_SERVER_CODE=1",
    "WITH_CEF3=1",
    "WITH_LIVE_CODING=0",
    "WITH_XGE_CONTROLLER=0",
    "UBT_MODULE_MANIFEST=\"UE4Editor.modules\"",
    "UBT_MODULE_MANIFEST_DEBUGGAME=\"UE4Editor-Mac-DebugGame.modules\"",
    "UBT_COMPILED_PLATFORM=Mac",
    "UBT_COMPILED_TARGET=Editor",
    "UE_APP_NAME=\"UE4Editor\"",
    "PLATFORM_MAC=1",
    "PLATFORM_APPLE=1",
    "WITH_TTS=0",
    "WITH_SPEECH_RECOGNITION=0",
    "NDEBUG=1",
    "UE_BUILD_DEVELOPMENT=1",
    "UE_IS_ENGINE_MODULE=0",
    "UE_PROJECT_NAME=MyProject",
    "IMPLEMENT_ENCRYPTION_KEY_REGISTRATION()=",
    "IMPLEMENT_SIGNING_KEY_REGISTRATION()=",
    "DEPRECATED_FORGAME=DEPRECATED",
    "UE_DEPRECATED_FORGAME=UE_DEPRECATED",
    "MYPROJECT_VTABLE=DLLEXPORT_VTABLE",
    "MYPROJECT_API=",
    "UE_ENABLE_ICU=1",
    "WITH_DIRECTXMATH=0",
    "WITH_MALLOC_STOMP=1",
    "CORE_VTABLE=DLLIMPORT_VTABLE",
    "CORE_API=",
    "TRACELOG_VTABLE=DLLIMPORT_VTABLE",
    "TRACELOG_API=",
    "COREUOBJECT_VTABLE=DLLIMPORT_VTABLE",
    "COREUOBJECT_API=",
    "INCLUDE_CHAOS=0",
    "WITH_PHYSX=1",
    "WITH_CHAOS=0",
    "WITH_CHAOS_CLOTHING=0",
    "WITH_CHAOS_NEEDS_TO_BE_FIXED=0",
    "PHYSICS_INTERFACE_PHYSX=1",
    "WITH_APEX=1",
    "WITH_APEX_CLOTHING=1",
    "WITH_CLOTH_COLLISION_DETECTION=1",
    "WITH_PHYSX_COOKING=1",
    "WITH_NVCLOTH=1",
    "WITH_CUSTOM_SQ_STRUCTURE=0",
    "WITH_IMMEDIATE_PHYSX=0",
    "GPUPARTICLE_LOCAL_VF_ONLY=0",
    "ENGINE_VTABLE=DLLIMPORT_VTABLE",
    "ENGINE_API=",
    "NETCORE_VTABLE=DLLIMPORT_VTABLE",
    "NETCORE_API=",
    "APPLICATIONCORE_VTABLE=DLLIMPORT_VTABLE",
    "APPLICATIONCORE_API=",
    "RHI_VTABLE=DLLIMPORT_VTABLE",
    "RHI_API=",
    "JSON_VTABLE=DLLIMPORT_VTABLE",
    "JSON_API=",
    "WITH_FREETYPE=1",
    "SLATECORE_VTABLE=DLLIMPORT_VTABLE",
    "SLATECORE_API=",
    "INPUTCORE_VTABLE=DLLIMPORT_VTABLE",
    "INPUTCORE_API=",
    "SLATE_VTABLE=DLLIMPORT_VTABLE",
    "SLATE_API=",
    "WITH_UNREALPNG=1",
    "WITH_UNREALJPEG=1",
    "WITH_UNREALEXR=1",
    "IMAGEWRAPPER_VTABLE=DLLIMPORT_VTABLE",
    "IMAGEWRAPPER_API=",
    "MESSAGING_VTABLE=DLLIMPORT_VTABLE",
    "MESSAGING_API=",
    "MESSAGINGCOMMON_VTABLE=DLLIMPORT_VTABLE",
    "MESSAGINGCOMMON_API=",
    "RENDERCORE_VTABLE=DLLIMPORT_VTABLE",
    "RENDERCORE_API=",
    "SOCKETS_PACKAGE=1",
    "SOCKETS_VTABLE=DLLIMPORT_VTABLE",
    "SOCKETS_API=",
    "ASSETREGISTRY_VTABLE=DLLIMPORT_VTABLE",
    "ASSETREGISTRY_API=",
    "ENGINEMESSAGES_VTABLE=DLLIMPORT_VTABLE",
    "ENGINEMESSAGES_API=",
    "ENGINESETTINGS_VTABLE=DLLIMPORT_VTABLE",
    "ENGINESETTINGS_API=",
    "SYNTHBENCHMARK_VTABLE=DLLIMPORT_VTABLE",
    "SYNTHBENCHMARK_API=",
    "RENDERER_VTABLE=DLLIMPORT_VTABLE",
    "RENDERER_API=",
    "GAMEPLAYTAGS_VTABLE=DLLIMPORT_VTABLE",
    "GAMEPLAYTAGS_API=",
    "PACKETHANDLER_VTABLE=DLLIMPORT_VTABLE",
    "PACKETHANDLER_API=",
    "RELIABILITYHANDLERCOMPONENT_VTABLE=DLLIMPORT_VTABLE",
    "RELIABILITYHANDLERCOMPONENT_API=",
    "AUDIOPLATFORMCONFIGURATION_VTABLE=DLLIMPORT_VTABLE",
    "AUDIOPLATFORMCONFIGURATION_API=",
    "MESHDESCRIPTION_VTABLE=DLLIMPORT_VTABLE",
    "MESHDESCRIPTION_API=",
    "STATICMESHDESCRIPTION_VTABLE=DLLIMPORT_VTABLE",
    "STATICMESHDESCRIPTION_API=",
    "PAKFILE_VTABLE=DLLIMPORT_VTABLE",
    "PAKFILE_API=",
    "RSA_VTABLE=DLLIMPORT_VTABLE",
    "RSA_API=",
    "NETWORKREPLAYSTREAMING_VTABLE=DLLIMPORT_VTABLE",
    "NETWORKREPLAYSTREAMING_API=",
    "PHYSICSCORE_VTABLE=DLLIMPORT_VTABLE",
    "PHYSICSCORE_API=",
    "COMPILE_WITHOUT_UNREAL_SUPPORT=0",
    "CHAOS_MEMORY_TRACKING=0",
    "CHAOS_VTABLE=DLLIMPORT_VTABLE",
    "CHAOS_API=",
    "CHAOS_CHECKED=0",
    "CHAOSCORE_VTABLE=DLLIMPORT_VTABLE",
    "CHAOSCORE_API=",
    "INTEL_ISPC=0",
    "VORONOI_VTABLE=DLLIMPORT_VTABLE",
    "VORONOI_API=",
    "FIELDSYSTEMCORE_VTABLE=DLLIMPORT_VTABLE",
    "FIELDSYSTEMCORE_API=",
    "WITH_PHYSX_RELEASE=0",
    "UE_PHYSX_SUFFIX=PROFILE",
    "UE_APEX_SUFFIX=PROFILE",
    "APEX_UE4=1",
    "APEX_STATICALLY_LINKED=0",
    "WITH_APEX_LEGACY=1",
    "SIGNALPROCESSING_VTABLE=DLLIMPORT_VTABLE",
    "SIGNALPROCESSING_API=",
    "WITH_RECAST=1",
    "UNREALED_VTABLE=DLLIMPORT_VTABLE",
    "UNREALED_API=",
    "BSPMODE_VTABLE=DLLIMPORT_VTABLE",
    "BSPMODE_API=",
    "DIRECTORYWATCHER_VTABLE=DLLIMPORT_VTABLE",
    "DIRECTORYWATCHER_API=",
    "DOCUMENTATION_VTABLE=DLLIMPORT_VTABLE",
    "DOCUMENTATION_API=",
    "LOAD_PLUGINS_FOR_TARGET_PLATFORMS=1",
    "PROJECTS_VTABLE=DLLIMPORT_VTABLE",
    "PROJECTS_API=",
    "SANDBOXFILE_VTABLE=DLLIMPORT_VTABLE",
    "SANDBOXFILE_API=",
    "EDITORSTYLE_VTABLE=DLLIMPORT_VTABLE",
    "EDITORSTYLE_API=",
    "SOURCE_CONTROL_WITH_SLATE=1",
    "SOURCECONTROL_VTABLE=DLLIMPORT_VTABLE",
    "SOURCECONTROL_API=",
    "UNREALEDMESSAGES_VTABLE=DLLIMPORT_VTABLE",
    "UNREALEDMESSAGES_API=",
    "GAMEPLAYDEBUGGER_VTABLE=DLLIMPORT_VTABLE",
    "GAMEPLAYDEBUGGER_API=",
    "BLUEPRINTGRAPH_VTABLE=DLLIMPORT_VTABLE",
    "BLUEPRINTGRAPH_API=",
    "EDITORSUBSYSTEM_VTABLE=DLLIMPORT_VTABLE",
    "EDITORSUBSYSTEM_API=",
    "HTTP_PACKAGE=1",
    "WITH_LIBCURL=0",
    "HTTP_VTABLE=DLLIMPORT_VTABLE",
    "HTTP_API=",
    "UNREALAUDIO_VTABLE=DLLIMPORT_VTABLE",
    "UNREALAUDIO_API=",
    "FUNCTIONALTESTING_VTABLE=DLLIMPORT_VTABLE",
    "FUNCTIONALTESTING_API=",
    "AUTOMATIONCONTROLLER_VTABLE=DLLIMPORT_VTABLE",
    "AUTOMATIONCONTROLLER_API=",
    "LOCALIZATION_VTABLE=DLLIMPORT_VTABLE",
    "LOCALIZATION_API=",
    "WITH_SNDFILE_IO=0",
    "AUDIOEDITOR_VTABLE=DLLIMPORT_VTABLE",
    "AUDIOEDITOR_API=",
    "AUDIOMIXER_VTABLE=DLLIMPORT_VTABLE",
    "AUDIOMIXER_API=",
    "TARGETPLATFORM_VTABLE=DLLIMPORT_VTABLE",
    "TARGETPLATFORM_API=",
    "LEVELEDITOR_VTABLE=DLLIMPORT_VTABLE",
    "LEVELEDITOR_API=",
    "SETTINGS_VTABLE=DLLIMPORT_VTABLE",
    "SETTINGS_API=",
    "INTROTUTORIALS_VTABLE=DLLIMPORT_VTABLE",
    "INTROTUTORIALS_API=",
    "HEADMOUNTEDDISPLAY_VTABLE=DLLIMPORT_VTABLE",
    "HEADMOUNTEDDISPLAY_API=",
    "VREDITOR_VTABLE=DLLIMPORT_VTABLE",
    "VREDITOR_API=",
    "COMMONMENUEXTENSIONS_VTABLE=DLLIMPORT_VTABLE",
    "COMMONMENUEXTENSIONS_API=",
    "LANDSCAPE_VTABLE=DLLIMPORT_VTABLE",
    "LANDSCAPE_API=",
    "PROPERTYEDITOR_VTABLE=DLLIMPORT_VTABLE",
    "PROPERTYEDITOR_API=",
    "ACTORPICKERMODE_VTABLE=DLLIMPORT_VTABLE",
    "ACTORPICKERMODE_API=",
    "SCENEDEPTHPICKERMODE_VTABLE=DLLIMPORT_VTABLE",
    "SCENEDEPTHPICKERMODE_API=",
    "DETAILCUSTOMIZATIONS_VTABLE=DLLIMPORT_VTABLE",
    "DETAILCUSTOMIZATIONS_API=",
    "CLASSVIEWER_VTABLE=DLLIMPORT_VTABLE",
    "CLASSVIEWER_API=",
    "GRAPHEDITOR_VTABLE=DLLIMPORT_VTABLE",
    "GRAPHEDITOR_API=",
    "STRUCTVIEWER_VTABLE=DLLIMPORT_VTABLE",
    "STRUCTVIEWER_API=",
    "CONTENTBROWSER_VTABLE=DLLIMPORT_VTABLE",
    "CONTENTBROWSER_API=",
    "ENABLE_HTTP_FOR_NFS=1",
    "NETWORKFILESYSTEM_VTABLE=DLLIMPORT_VTABLE",
    "NETWORKFILESYSTEM_API=",
    "UMG_VTABLE=DLLIMPORT_VTABLE",
    "UMG_API=",
    "MOVIESCENE_VTABLE=DLLIMPORT_VTABLE",
    "MOVIESCENE_API=",
    "TIMEMANAGEMENT_VTABLE=DLLIMPORT_VTABLE",
    "TIMEMANAGEMENT_API=",
    "MOVIESCENETRACKS_VTABLE=DLLIMPORT_VTABLE",
    "MOVIESCENETRACKS_API=",
    "ANIMATIONCORE_VTABLE=DLLIMPORT_VTABLE",
    "ANIMATIONCORE_API=",
    "PROPERTYPATH_VTABLE=DLLIMPORT_VTABLE",
    "PROPERTYPATH_API=",
    "NAVIGATIONSYSTEM_VTABLE=DLLIMPORT_VTABLE",
    "NAVIGATIONSYSTEM_API=",
    "MESHDESCRIPTIONOPERATIONS_VTABLE=DLLIMPORT_VTABLE",
    "MESHDESCRIPTIONOPERATIONS_API=",
    "MESHBUILDER_VTABLE=DLLIMPORT_VTABLE",
    "MESHBUILDER_API=",
    "MATERIALSHADERQUALITYSETTINGS_VTABLE=DLLIMPORT_VTABLE",
    "MATERIALSHADERQUALITYSETTINGS_API=",
    "INTERACTIVETOOLSFRAMEWORK_VTABLE=DLLIMPORT_VTABLE",
    "INTERACTIVETOOLSFRAMEWORK_API=",
    "TOOLMENUSEDITOR_VTABLE=DLLIMPORT_VTABLE",
    "TOOLMENUSEDITOR_API=",
    "ASSETTAGSEDITOR_VTABLE=DLLIMPORT_VTABLE",
    "ASSETTAGSEDITOR_API=",
    "COLLECTIONMANAGER_VTABLE=DLLIMPORT_VTABLE",
    "COLLECTIONMANAGER_API=",
    "ADDCONTENTDIALOG_VTABLE=DLLIMPORT_VTABLE",
    "ADDCONTENTDIALOG_API=",
    "USE_EMBREE=1",
    "MESHUTILITIES_VTABLE=DLLIMPORT_VTABLE",
    "MESHUTILITIES_API=",
    "MESHMERGEUTILITIES_VTABLE=DLLIMPORT_VTABLE",
    "MESHMERGEUTILITIES_API=",
    "HIERARCHICALLODUTILITIES_VTABLE=DLLIMPORT_VTABLE",
    "HIERARCHICALLODUTILITIES_API=",
    "MESHREDUCTIONINTERFACE_VTABLE=DLLIMPORT_VTABLE",
    "MESHREDUCTIONINTERFACE_API=",
    "ASSETTOOLS_VTABLE=DLLIMPORT_VTABLE",
    "ASSETTOOLS_API=",
    "KISMETCOMPILER_VTABLE=DLLIMPORT_VTABLE",
    "KISMETCOMPILER_API=",
    "GAMEPLAYTASKS_VTABLE=DLLIMPORT_VTABLE",
    "GAMEPLAYTASKS_API=",
    "WITH_GAMEPLAY_DEBUGGER=1",
    "AIMODULE_VTABLE=DLLIMPORT_VTABLE",
    "AIMODULE_API=",
    "KISMET_VTABLE=DLLIMPORT_VTABLE",
    "KISMET_API=",
    "PHYSICSSQ_VTABLE=DLLIMPORT_VTABLE",
    "PHYSICSSQ_API=",
    "CHAOSSOLVERS_VTABLE=DLLIMPORT_VTABLE",
    "CHAOSSOLVERS_API=",
    "GEOMETRYCOLLECTIONCORE_VTABLE=DLLIMPORT_VTABLE",
    "GEOMETRYCOLLECTIONCORE_API=",
    "GEOMETRYCOLLECTIONSIMULATIONCORE_VTABLE=DLLIMPORT_VTABLE",
    "GEOMETRYCOLLECTIONSIMULATIONCORE_API=",
    "CLOTHINGSYSTEMRUNTIMEINTERFACE_VTABLE=DLLIMPORT_VTABLE",
    "CLOTHINGSYSTEMRUNTIMEINTERFACE_API=",
    "AUDIOMIXERCORE_VTABLE=DLLIMPORT_VTABLE",
    "AUDIOMIXERCORE_API="
],

Which were?

Line 10 in the header file it says the colon is a error and when I hover over it it says “expected a ';”

There is a similar problem on line 4 of the .cpp file where it says the same thing.

Then on line 74, 76, and 88 it gives me the error “expected a declaration”

In addition the variables are no longer colored.

What is the defines you are using for that project?

I am using the ones I got from 4.24.3

On line 74 you aren’t using the right character. It should be minus - not a dash.

It might be because you haven’t changed

`UE_PROJECT_NAME=MYPROJECTNAME`
"MYPROJECT_VTABLE=DLLEXPORT_VTABLE",
"MYPROJECT_API=",

What I did was change MYPROJECTNAME to the name of my game file.

Here’s an example

"UE_PROJECT_NAME=BullCowGame",
"BULLCOWGAME_VTABLE=DLLEXPORT_VTABLE",
"BULLCOWGAME_API=",

I’m using a MAC and VS code along with the latest engine update of unreal and this seemed to remove the same errors you had

Thank you for your suggestions, I had already changed the “MyProjectName” and I believe I was using the right character as a minus I did retype it and it gave me the same error and I even copied and pasted the character you posted here and it gave me the same error, the code was running fine it was just a bug in Visual Studio Code not recognizing the defines.

I’m still not sure what the problem was but I was able to fix it. I copied the header file and .cpp file as a text file. I then deleted everything else that I had and downloaded the BullCowGame-starter-kit.zip from Lesson 35. Importing Bull Cow Game. I copied over my header and .cpp files that I saved from before into the new game folder. Afterward, I copied the defines for mac into the c_cpp_properties.json file and changed the MyProjectName by using Command F and searched for MyProjectName as it is in a different location in the file than the video for windows showed. I saved and compiled and it seemed to work great. Thanks to all of those who posted suggestions!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms