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"

VS Code: Code shows errors in IDE, yet builds are successful

I have issues, reminiscent of IDE errors from Visual Studio, were the IDE is putting out false errors, which lead to no or limited intellisense. I have rebuilt the project a few times, re-generated the project, tried to run with Editor open, and closed.

The project does build with no errors, so these are IDE issues, but I do't know if they are caused by unreal setup or VS Code itself.

Also note: This is in a plugin, and it doesn't seem to understand the class SIMPLESOCKETS_API part... there are still errors if I remove it, but it stops saying that SIMPLESOCKETS_API is a class.

Environment: Windows 10, Just clicked Update on VSCode (1.18.1?), 4.18 Unreal.

Basic CCP Basic Header

Product Version: UE 4.18
Tags:
cpp.png (24.7 kB)
h.png (7.5 kB)
more ▼

asked Nov 24 '17 at 06:04 PM in C++ Programming

avatar image

tenowg
121 5 7 11

avatar image BugSwat Nov 24 '17 at 06:17 PM

What does it say as "error" when you hover your mouse over the red underlined words?

avatar image tenowg Nov 24 '17 at 06:29 PM

in the header file, the : when hovered says 'expected a ";"'

in the cpp file: On USocketComponent:: it says "name followed by '::' must be a class or namespace name" also same error on Super:: and any variable error reads "identifier 'variablename' is undefined"

avatar image c4tnt Nov 25 '17 at 10:42 AM

It's not an error but just an MSVC inaccuracy. These underlines usually disappear when MSVC finishes to build a program database.

avatar image tenowg Nov 30 '17 at 03:31 AM

so how long should it take to build a program database? its been a very long time and I still get these errors...

avatar image BugSwat Nov 30 '17 at 11:29 AM

It is in most cases for me a missing include. But in most cases I don't want that. The code is building, more includes mean longer build time. So the IDE is not happy. So what? Who cares.

avatar image IribaesRom Dec 01 '17 at 05:38 AM

So what? Who cares.

Really? It's kind of a big deal. This throws off all useful linting from vscode because it's hung on this one error.

Here's an example of why this could be a headache for someone. There's a simple typo that would normally be caught by the linter, but now it isn't. example

avatar image IribaesRom Dec 01 '17 at 05:44 AM

Same problem here. New project, all I've done here is create an Actor C++ file. My environment is macOS 10.13.1, UE 4.18.

TestActor.h

TestActor.cpp

avatar image CraftedCart Dec 23 '17 at 08:02 PM

Same issue over here (Linux, UE 4.18.2) - Plonking "C_Cpp.intelliSenseEngine": "Tag Parser", in your VSCode config seems to help (In terms of better tag completion), but then you're left with zero error checking :/

avatar image IribaesRom Feb 26 '18 at 02:42 AM

This is the best I've seen so far. But yeah, still no error checking, so it's not reason enough for me to switch :/

avatar image tenowg Dec 24 '17 at 02:31 AM

I have just continued working on my project while I hope this gets looked at eventually... I just have to build and wait for compile errors to show any typos, etc... also more research is required to remember the methods and properties that intellisense would simply remind of on a regular basis. Fairly annoying... I will try @CraftedCart's option and see if it makes it any better tho.

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

3 answers: sort voted first

As already said, the problem is solved by fixing the file c_cpp_properties.json. I just copied the definitions from the Visual Studio 2017 project and it worked.

The code for c_cpp_properties.json file (works for UE 4.18 and Windows 10) But you need to change the line: "ORIGINAL_FILE_NAME='UE4Editor-ProjectName.dll'"

 "defines": [
                 "IS_PROGRAM=0",
                 "UE_EDITOR=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_COREUOBJECT=1",
                 "USE_STATS_WITHOUT_ENGINE=0",
                 "WITH_PLUGIN_SUPPORT=0",
                 "WITH_PERFCOUNTERS=1",
                 "USE_LOGGING_IN_SHIPPING=0",
                 "WITH_LOGGING_TO_MEMORY=0",
                 "USE_CACHE_FREED_OS_ALLOCS=1",
                 "USE_CHECKS_IN_SHIPPING=0",
                 "UE_BUILD_MINIMAL=0",
                 "WITH_EDITOR=1",
                 "WITH_SERVER_CODE=1",
                 "WITH_CEF3=1",
                 "WITH_XGE_CONTROLLER=1",
                 "UBT_COMPILED_PLATFORM=Win64",
                 "UBT_COMPILED_TARGET=Editor",
                 "WIN32=1",
                 "_WIN32_WINNT=0x0601",
                 "WINVER=0x0601",
                 "PLATFORM_WINDOWS=1",
                 "DEPTH_32_BIT_CONVERSION=0",
                 "NDEBUG=1",
                 "UE_BUILD_DEVELOPMENT=1",
                 "ORIGINAL_FILE_NAME='UE4Editor-ProjectName.dll'",
                 "UE_IS_ENGINE_MODULE=0",
                 "UE_BUILD_DEVELOPMENT_WITH_DEBUGGAME=0",
                 "UE_PROJECT_NAME=NewTest",
                 "DEPRECATED_FORGAME=DEPRECATED",
                 "NEWTEST_API=",
                 "UE_ENABLE_ICU=1",
                 "WITH_VS_PERF_PROFILER=0",
                 "WITH_DIRECTXMATH=0",
                 "CORE_API=",
                 "COREUOBJECT_API=",
                 "WITH_PHYSX=1",
                 "WITH_APEX=1",
                 "WITH_APEX_CLOTHING=1",
                 "WITH_CLOTH_COLLISION_DETECTION=1",
                 "WITH_PHYSX_COOKING=1",
                 "WITH_NVCLOTH=1",
                 "WITH_RECAST=1",
                 "ENGINE_API=",
                 "APPLICATIONCORE_API=",
                 "RHI_API=",
                 "JSON_API=",
                 "SLATE_DEFERRED_DESIRED_SIZE=0",
                 "WITH_FREETYPE=1",
                 "SLATECORE_API=",
                 "INPUTCORE_API=",
                 "SLATE_API=",
                 "WITH_UNREALPNG=1",
                 "WITH_UNREALJPEG=1",
                 "WITH_UNREALEXR=1",
                 "IMAGEWRAPPER_API=",
                 "MESSAGINGCOMMON_API=",
                 "MESSAGING_API=",
                 "RENDERCORE_API=",
                 "SHADERCORE_API=",
                 "UTILITYSHADERS_API=",
                 "ASSETREGISTRY_API=",
                 "ENGINEMESSAGES_API=",
                 "ENGINESETTINGS_API=",
                 "SYNTHBENCHMARK_API=",
                 "RENDERER_API=",
                 "GAMEPLAYTAGS_API=",
                 "WITH_GAMEPLAY_DEBUGGER=1",
                 "AIMODULE_API=",
                 "GAMEPLAYTASKS_API=",
                 "DATABASESUPPORT_API=",
                 "PACKETHANDLER_API=",
                 "RELIABILITYHANDLERCOMPONENT_API=",
                 "HARDWARESURVEY_API=",
                 "UNREALED_API=",
                 "BSPMODE_API=",
                 "DIRECTORYWATCHER_API=",
                 "DOCUMENTATION_API=",
                 "LOAD_PLUGINS_FOR_TARGET_PLATFORMS=1",
                 "PROJECTS_API=",
                 "SANDBOXFILE_API=",
                 "EDITORSTYLE_API=",
                 "SOURCE_CONTROL_WITH_SLATE=1",
                 "SOURCECONTROL_API=",
                 "UNREALEDMESSAGES_API=",
                 "GAMEPLAYDEBUGGER_API=",
                 "BLUEPRINTGRAPH_API=",
                 "HTTP_PACKAGE=1",
                 "HTTP_API=",
                 "UNREALAUDIO_API=",
                 "FUNCTIONALTESTING_API=",
                 "AUTOMATIONCONTROLLER_API=",
                 "LOCALIZATION_API=",
                 "AUDIOEDITOR_API=",
                 "LEVELEDITOR_API=",
                 "SETTINGS_API=",
                 "INTROTUTORIALS_API=",
                 "HEADMOUNTEDDISPLAY_API=",
                 "VREDITOR_API=",
                 "LANDSCAPE_API=",
                 "PROPERTYEDITOR_API=",
                 "ACTORPICKERMODE_API=",
                 "SCENEDEPTHPICKERMODE_API=",
                 "DETAILCUSTOMIZATIONS_API=",
                 "CLASSVIEWER_API=",
                 "GRAPHEDITOR_API=",
                 "CONTENTBROWSER_API=",
                 "ENABLE_HTTP_FOR_NFS=1",
                 "NETWORKFILESYSTEM_API=",
                 "SOCKETS_PACKAGE=1",
                 "SOCKETS_API=",
                 "UMG_API=",
                 "MOVIESCENE_API=",
                 "MOVIESCENETRACKS_API=",
                 "WITH_OGGVORBIS=1",
                 "XAUDIO2_API=",
                 "AUDIOMIXERXAUDIO2_API=",
                 "COLLECTIONMANAGER_API=",
                 "ADDCONTENTDIALOG_API=",
                 "USE_EMBREE=1",
                 "MESHUTILITIES_API=",
                 "MESHMERGEUTILITIES_API=",
                 "HIERARCHICALLODUTILITIES_API=",
                 "MESHREDUCTIONINTERFACE_API=",
                 "ASSETTOOLS_API=",
                 "KISMETCOMPILER_API=",
                 "KISMET_API=",
                 "CLOTHINGSYSTEMRUNTIMEINTERFACE_API=",
                 "NETWORKREPLAYSTREAMING_API=",
                 "AUDIOMIXER_API="
             ]

more ▼

answered Feb 25 '18 at 10:30 AM

avatar image

maximangetman
46 3 4

avatar image IribaesRom Feb 26 '18 at 02:45 AM

While I agree that the c_cpp_properties.json file is likely the culprit, your solution did not work for me. I may have just copied something wrong, or my project may required different defines than yours, however.

Could you let us know where you found this list? I looked through the .vs files and my VS2017 project and couldn't find any list of defines like this.

avatar image maximangetman Feb 26 '18 at 07:19 AM

In Visual Studio 2017: Project > Properties > Nmake > Preprocessor Definition > Edit (And check the Include Search Path > Edit)

avatar image IribaesRom Feb 26 '18 at 02:10 PM

:DDDDD

This is it!!! It totally works :D Thank you so much!!

avatar image XQDD May 29 '18 at 07:00 AM

Work for me, Just change PROJECT_NAME to yours:

 "ORIGINAL_FILE_NAME='UE4Editor-PROJECT_NAME.dll'",
 "UE_PROJECT_NAME=PROJECT_NAME",
 "PROJECT_NAME_API=",

By the way, you can find the Definitions at

 YOUR_PROJECT_PATH/Intermediate/ProjectFiles/PROJECT_NAME.vcxproj (NMakePreprocessorDefinitions)

without open Visual Studio

But I will use this in the vs code settings.

 "C_Cpp.intelliSenseEngine": "Tag Parser",

For the reason that the when you flesh vs code in unreal engine, the c_cpp_properties.json will flesh witch annoyed me.

avatar image parityb1t Jun 08 '18 at 06:26 PM

This worked for me yesterday :) But adding a new C++ Class or refreshing the Project code wipes the settings, any workarounds?

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

include "Engine.h" !!!!

in your .h file.

source:http://blog.csdn.net/noahzuo/article/details/51126759

more ▼

answered Dec 26 '17 at 01:52 PM

avatar image

Seuen
1 1

avatar image Seuen Dec 25 '17 at 12:36 PM

![alt text][1]

like this

vscode.png (26.9 kB)
avatar image tenowg Dec 26 '17 at 11:53 PM

I have added this, and, yes the errors go away, but now I need to know why this happens... before I can say this is the definitive answer.

avatar image Seuen Dec 31 '17 at 01:18 PM

i dont know more. syntax error caused by "InputCoreTypes.h"

avatar image IribaesRom Feb 26 '18 at 02:43 AM

I mean, yeah including "Engine.h" in the code might solve this, but we really should not have to be doing this. There's a reason UE4 stopped that practice.

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

I fixed it by updating my c_cpp_properties.json. The "defines" field can take values in the form of "define=value", so in my case I was working with a FPSGAME_API causing the issue and I made my defines:

             "defines": [
                 "_DEBUG",
                 "UNICODE",
                 "FPSGAME_API="
             ],

You can probably do something similar with "SIMPLESOCKETS_API="

more ▼

answered Jan 24 '18 at 03:00 PM

avatar image

Pux0r3
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