Jump to content
  • Advertisement
Magogan

Visual Studio IntelliSense bug

This topic is 410 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

since I switched from Visual Studio 2013 to Visual Studio 2015, IntelliSense (or Visual Studio itself) is broken on one of my projects: It is not only really slow (code suggestions take about 10 seconds to load in some files) but also shows errors that are no errors and does not parse the code correctly - some functions do not even show up in the navigation bar on top.

The following produces an error:

#ifndef _WIN32
    DueTime = Params->StartTime - GetHighPrecisionTime();

#else

	HANDLE TickTimer = CreateWaitableTimer(0, true, 0);
	bool DoWait = true;
	{
		auto CurrentTime = GetHighPrecisionTime();
		int64_t DueTime = std::min(-20000LL * (int64_t)Params->TickIntervalMs + (CurrentTime - Params->StartTime).GetTimeIn100Nanoseconds(), 0LL);
		if (DueTime == 0) DoWait = false;

		if (DoWait) {
			LARGE_INTEGER liDueTime;
			liDueTime.QuadPart = DueTime;
			SetWaitableTimer(TickTimer, &liDueTime, 0, NULL, NULL, 0);
		}
	}
#endif

In the line below "bool DoWait = true;" it shows the error "expected a declaration" although there is only a brace "{". The code compiles without errors or warnings, but this error is really annoying when you code something and you have to manually look up everything... Even things like the call hierarchy do not work properly.

I think the #ifdef directives break Visual Studio/IntelliSense since it works when you remove them, but why does it happen in the first place and why only with this project although my other project also uses #ifdef directives.

Reinstalling Visual Studio didn't help.

Does anyone have an idea on how to fix this?

Share this post


Link to post
Share on other sites
Advertisement

Did you try to delete the intellisense-cache file(s)? Should be .sdf located in the root folder of your project with the same name as the .sln, and/or .suo (which are hidden). This should normally resolve the issue.

Share this post


Link to post
Share on other sites

I deleted everything except for the .sln, .vcxproj, .vcxproj.user, and vcxproj.filters files. I even tried to delete the project and generate a new one (I copied the filters and project settings because I didn't want to add all the files manually) but it didn't help.

Share this post


Link to post
Share on other sites

Can you post a minimal example of your code that exhibits this problem, maybe to a site like GitHub or as a ZIP file?

Share this post


Link to post
Share on other sites

I don't think I can find a minimal example because there are more than 100 files and the files where these errors occur include about 20 headers... I don't want to post everything since this is going to be used for commercial purposes...

However, I'm trying to find out what triggers the error. This might take a while.

 

Edit: I tracked it down to the file "database.hpp": When I include it in "network.cpp" (which has #ifdef directives), I get 157 IntelliSense errors, when I remove it, I get 0. That file contains a lot of templated classes and functions, but the code is actually valid C++ and compiles without errors, as I already said.

I copied code to "database.cpp" as a workaround so "database.hpp" only needs to be included in "database.cpp". No IntelliSense errors so far.

 

Edit 2: It still does not recognize some of the member functions in class System. At least I got the Express version and didn't pay for this s**t...

Edited by Magogan

Share this post


Link to post
Share on other sites

Over the years I've noticed the things that make IntelliSense choke are also the systems that disturb my sense of rightness.  Usually code based heavily on macros to construct things that probably shouldn't be macros, but instead use things like CRTP. 

There is often code that is "valid C++", where it only compiles after the compiler has had to go through multiple rounds of substitutions and various gyrations to figure out exactly what things can go in and still produce valid results.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!