Why I get error hints from Visual Studio 2017? - visual-studio

I have my visual studio 2017 display red lines under many statements although the code compile fine !! any idea why and how to fix this ?
here is a picture
hover over one of the errors:

Before actually compiling and linking the game UE4 runs its own Unreal Header Tool. It generates a great deal of extra code. Because of that Visual Studio sometimes doesn't find some of the symbols that will be available after generation. There's is a page that explains that it's normal when you work with UE4.
Also, consider this. UE4 may use a unity build so it will make a giant .cpp file out of all your source files. It may happen that all of your "false positive" errors are resolved by the order in which those source files are included. But since Visual Studio treats every source file as a separate translation unit (not unity build) it will make sure that you don't use any undefined symbols.
If squiggles bother you too much, try to include all of the headers with the necessary symbols (for example "Components/InputComponent.h") in your source file.

Related

How can I track a C2100 (illegal indirection) or C2675 error in a large visual studio project?

I am working on a very large project that is being built in visual studio 2019. Using this newer version of the compiler, we found two errors crop up in xutility - C2100 (illegal indirection) and C2675 (unary++ operator not defined). They did not show up before when compiled in Linux under a different chain.
To be clear: Xutility (which is part of Visual Studio/MSVCC) is of course not the actual broken code. It's just somehow, the broken code that we have written is getting compiled into using Xutility template code, which then is where the error shows up. So double clicking the error only takes me to xutility, not the root of the problem.
Now, this is a huge project with many large third-party libraries. Does Visual Studio have any way of telling me what source file the error actually occurred in? (Or, at least, the first occurrence?)
If I can't find the source file responsible it will be impossible to fix.

How is it possible to get full intellisene on Pybind11 in visual studio?

I'm working with Pybind11 in Visual Studio 2015. I configured the projects necessary properties. that is I set the include and library directories accordingly. That is I set them to these values:
Include Directories:
L:\FV\pybind11\pybind11\include;C:\Users\Master\Anaconda3\include;L:\FV\pybind11\pybind11\pybind11;$(IncludePath)
and for Library Directories:
C:\Users\Master\Anaconda3\Lib;C:\Users\Master\Anaconda3\libs;$(LibraryPath)
and currently everything seems working and compilations succeeds.
However, I get wiggly error lines when trying to use different methods, classes, etc from Pybind11, which is related to the intellisense failing to get the needed information.
This is how it looks :
Is there a way I can fix this and get full intellisense in this regard?
Upgraded to Visual Studio 2019 and the intellisense is working perfectly. This seems like an inherent problem in VS2015 and its lack of ability to properly index and provide intellisense.

Compile VxWorks project in Visual Studio

I have a VxWorks project that compiles under Toronado on my Win7 machine. I am trying to convert the same project to compile in my Visual Studio 2010. I don't need it to complete to where it creates a .o/out file but at least get through all the defines/includes and etc. so I can use Visual Studio's IDE for definition jumping and etc..
I'm at a point where I'm getting a 'undeclared identifier' for "_interrupt" which is included in several include files from the ..\tornado\target\config\ folder.
I'd appreciate any suggestions
Thanks
I would like to comment on this but don't have enough points.
I do the same thing using eclipse instead of visual studio, I don't do anything special to make it work.
It sounds like you are trying to do the link even though you don't want to. Make sure when you create your project you set it up to create a library not an executable, it should do the compile then but no linking.

Visual Studio 2010 randomly says the command line changed, and rebuilds

Visual Studio sometimes decides to rebuild my entire huge project because of one small change. I turned build logging up to Diagnostic to see what was the problem, and here's what I'm seeing:
< Bunch of spam >
Outputs for C:\<snip>\PRECOMPILEDHEADERS.CPP:
C:\<snip>\PRECOMPILEDHEADERS.OBJ
All outputs are up-to-date.
Forcing rebuild of all source files due to a change in the command line
... and then it rebuilds my precompiled headers, then everything else.
This happens when I change a single .cpp or .h file inside the project. I'm not changing anything in the project settings. It also doesn't happen all the time for the same change; it's random.
Any ideas on what's going on here? Where can I get more information? I tried enabling debugging via the description in http://blogs.msdn.com/b/vsproject/archive/2009/07/21/enable-c-project-system-logging.aspx but it didn't give any more information. I can't figure out where this "Forcing rebuild of all source files due to a change in the command line" is coming from. It's not in any of the factory MSBuild files.
Some other info: it's a C++/CLI dll project that links a lot of other projects, including C#, native c++, and other C++/CLI dll's. I tried removing all the C# projects from the dependencies since those tend to cause problems, but that didn't change it. I've googled that specific string, but my situation doesn't match that of any of the other people reporting it. (One was using Intel C++, another was MSBuild from the command line and changing the case. I'm hitting build solution from within Visual Studio itself).
Edit to explain common fixes I've tried:
I've tried building only the project. Does the same thing.
I'm not including any .h files that don't exist.
I've deleted the bin/object folders and rebuilt from scratch. This usually makes it go away for a couple builds, but then it comes right back.
Edit #2:
Found something suspicious earlier in the log:
3>Using "ResolveNonMSBuildProjectOutput" task from assembly "Microsoft.Build.Tasks.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
3>Task "ResolveNonMSBuildProjectOutput"
3> Resolving project reference "..\..\..\..\CommonCore\VS2010\Project1\Project1.vcxproj".
3> Project reference "..\..\..\..\CommonCore\VS2010\Project1\Project1.vcxproj" has not been resolved.
This is repeated for several of my projects... I'm gonna chase that down and see if maybe it's a problem with the project reference hint paths.
Ok, it's an old thread, but I encountered the same problem recently.
My solution was to disable the precompiled headers - now a simple change in one sourcefile won't lead into a "rebuild" any more.
I have had the same problem with Visual Studio 2012 recently. I'm on Windows 7 with Visual Studio 2012 Professional (2012.2) building C++ projects. It's worth noting that I recently migrated the solution from Visual Studio 2008 to Visual Studio 2012.
One of the C++ projects (an executable with a DLL project as a reference) was rebuilding every time one of its compilation units was changed, e.g. simply saving main.cpp would cause all compilation units (including the pre-compiled header) to rebuild. I spotted the the following message in the build logs:
Forcing rebuild of all source files due to a change in the command line since the last build.
I turned build log file verbosity to Diagnostic (Tools > Options > Projects and Solutions > Build and Run) and compared the log files from a clean build and a build after one compilation unit has been changed (which forced a full rebuild). I noticed that:
"Path" had changed from one build to the next (";C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\VsGraphics" seems to have been tacked on the end)
there was a difference in TaskTracker.exe command lines to do with CancelEvents
there was a warning about OutputPath not being set
I pulled my hair out.
I eventually resorted to recreating the offending project from scratch rather than relying on the project that was automatically generated during the migration process from 2008 to 2012. It seems to be behaving as expected now.
I did three things, and the problem seems to have gone away. I'm trying to narrow it down a little but I figured I'd go ahead and post them:
Deleted and re-added all the references and project references
Fixed one of my projects that wasn't setting the .NET framework target to 3.5 to match the rest of my solution (I was getting away with it because the project didn't use .NET anyway)
Set "Copy Local Satellite Assemblies" to false for all references including System ones.
Beware that some or all of this stuff might be voodoo...

Visual Studio 2010 intellisense problem

I have the following intellisense problem, which only occurs in the Release configuration, even though both Debug and Release use the exact same file paths.
I've never had problems like this with Visual C++ 2010.
Are you sure that header is in the include path for the project? That's what it sounds like. The preprocessor is not parsing Window.hpp because it isn't being told to find it. Right clicking on your project and setting extra include directories should fix it.

Resources