Page 1 of 1

Intellisense issue in VC 2008 express

Posted: Thu Jul 17, 2008 11:55 pm
by mrmclovin
Hello, I've encountered a problem with Intellisense. It cant find all of my classes, spread over a few files. After time of search and research, i deleted an 'Additional include directories' entry. The entry defined a path to the local projects include files where all my classheaders are defined and poof, intellisense found all classes. The problem now is that i cant compile since i removed the include dir... :P

Has someone experince regarding this why intellisense acts like this?

Posted: Fri Jul 18, 2008 12:25 am
by RedEyeCoder
Visual Assist X is the answer to all your problems :)

Re: Intellisense issue in VC 2008 express

Posted: Fri Jul 18, 2008 1:10 am
by xavier
mrmclovin wrote:Hello, I've encountered a problem with Intellisense. It cant find all of my classes, spread over a few files. After time of search and research, i deleted an 'Additional include directories' entry. The entry defined a path to the local projects include files where all my classheaders are defined and poof, intellisense found all classes. The problem now is that i cant compile since i removed the include dir... :P

Has someone experince regarding this why intellisense acts like this?
Put the directory back. I don't know where you saw that advice but you must have misinterpreted it.

Delete the .ncb file in the same directory as your .sln. That's Intellisense's database. You have to do the same thing with VAX, btw (albeit with a different method) -- anything that parses code to help you with it, can get confused with lots of code changes.

Posted: Fri Jul 18, 2008 5:30 am
by RedEyeCoder
Aye, VAX just screws up a whole lot less :)

Re: Intellisense issue in VC 2008 express

Posted: Fri Jul 18, 2008 1:46 pm
by mrmclovin
xavier wrote:
mrmclovin wrote:Hello, I've encountered a problem with Intellisense. It cant find all of my classes, spread over a few files. After time of search and research, i deleted an 'Additional include directories' entry. The entry defined a path to the local projects include files where all my classheaders are defined and poof, intellisense found all classes. The problem now is that i cant compile since i removed the include dir... :P

Has someone experince regarding this why intellisense acts like this?
Put the directory back. I don't know where you saw that advice but you must have misinterpreted it.

Delete the .ncb file in the same directory as your .sln. That's Intellisense's database. You have to do the same thing with VAX, btw (albeit with a different method) -- anything that parses code to help you with it, can get confused with lots of code changes.
I've already tried to delete the .ncb but to no avail. If I am editing the file where a class which intellisense not recognize, the class popups in the class list but will disappear again after 2 seconds ..

more suggentions/hints?

Posted: Fri Jul 18, 2008 2:20 pm
by Chris Jones
I've already tried to delete the .ncb but to no avail.
are you closing visual studio before deleting the file?

also, VAX does occaisionally get problems, but it has built-in features for clearing the cache etc rather than having to find the file to delete. It's also possible to get it to reparse a file.

Posted: Fri Jul 18, 2008 3:04 pm
by mrmclovin
Chris Jones wrote:
I've already tried to delete the .ncb but to no avail.
are you closing visual studio before deleting the file?

also, VAX does occaisionally get problems, but it has built-in features for clearing the cache etc rather than having to find the file to delete. It's also possible to get it to reparse a file.
Yes, I've tried all "common" solutions (like deleted .ncb, rebuild, resave etc.). I suspect that it's possible that it has to do with how all files/classes are connected to eachother due to #include, #ifndef-#define, and which directories you set in VC++. It's just my theory atm, and I was therefore wondering if someone can give me hints/experience about what I should try to do.

I'm using the conventional anti-redefine:

Code: Select all

#ifndef CLASS_H
#defined CLASS_H
#include some_include_files
namespace my_namespace{
   class a_class {};
}
#endif

(and the source/defintion goes in .cpp-files)

 
what in this does intellisense not understand? :P

Posted: Thu Oct 23, 2008 6:13 pm
by mrmclovin
I'm still looking for a solution for this as not even Google can help me. The closest clue I've got into is what I said in the first post. When I delete the local include path entry, intellisense recognize every class and method I've defined! It even know in what file the class is defined. While intellisense knows, VC++ does not .. since I cant open a file via the #include statement. Looking for new ideas !!?? I will not let intellisense win

Posted: Thu Oct 23, 2008 6:39 pm
by KungFooMasta
As mentioned above, you should only need to do the following:

1. Clean all projects.
2. Close Visual Studio
3. Delete .ncb file
4. Open Project/Solution in Visual Studio
5. Build all projects.
6. Give a little time for intellisense database to be built in background. Sometimes you can see intellisense being updated in the status bar.

If all else fails, commit to SVN, wipe your disk of all traces of this app, grab code from SVN, and build project(s).

Posted: Thu Oct 23, 2008 9:40 pm
by Fish
I had a similar issue with VS2008 when I tried to reuse project files created with VS2003. Many classes were not visible and occasionally intellisense would hang. I used the process KungFooMasta wrote above and that fixed the problem with the invisible classes, however intellisense would hang each time I updated a class with a simple variable (like int foo;).

In the end I reverted to VS2005 express and have not had any problems.

Posted: Fri Oct 24, 2008 4:11 am
by syedhs
Fish wrote:I had a similar issue with VS2008 when I tried to reuse project files created with VS2003. Many classes were not visible and occasionally intellisense would hang. I used the process KungFooMasta wrote above and that fixed the problem with the invisible classes, however intellisense would hang each time I updated a class with a simple variable (like int foo;).
Just wondering, have you applied SP1 for VC8? I didn't use VC8, but I think it may have solved the problem.

Posted: Fri Oct 24, 2008 1:18 pm
by mrmclovin
As mentioned above, you should only need to do the following:

1. Clean all projects.
2. Close Visual Studio
3. Delete .ncb file
4. Open Project/Solution in Visual Studio
5. Build all projects.
6. Give a little time for intellisense database to be built in background. Sometimes you can see intellisense being updated in the status bar.

If all else fails, commit to SVN, wipe your disk of all traces of this app, grab code from SVN, and build project(s).
As I said, I've tried all _common_ solutions like the one you are suggesting. Intellisense behaves the same on 2 diffrent computers with 2 diffrent OS's and tested on VC++ 2005 and 2008. I'm quite sure it has to do something with my code and how intellisense interprets it.

My files generally have the structure:
Prereq.h

Code: Select all

namespace myNamespace {
class Foo;
class Bar;
}
Foo.h

Code: Select all

#include "Prereq.h"
namespace myNamespace {
class Foo {
  public:
    Bar* bar;
}
}
Foo.cpp

Code: Select all

#include "Foo.h"
namespace myNamespace {
#include "Bar.h"
[...]
}

So, I'm looking for new ideas that goes outside of the _common_ solutions as they don't work out for me!

Thanks!

Posted: Fri Oct 24, 2008 3:45 pm
by syedhs
I dont know if this solves your problem, but in Foo.h, the class declaration should be terminated by ;. In VC2005, Intellisense will not function properly if your code doesn't compile.

Posted: Sat Oct 25, 2008 4:01 pm
by mrmclovin
My misstake. There are ; after each class declartion in the actual code. Everything compiles and run.

Re: Intellisense issue in VC 2008 express

Posted: Sun Mar 08, 2009 7:14 pm
by mrmclovin
Now, a couple of months later, Intellisense has gone less of a pain in the ass. Most of my classes and methods are recognized. I did not make any major changes in my code layout but I remember one thing I did and that was that I changed name on my core classes which were named like Application, Input, Physics etc to ApplicationManager, InputManager and so on. It could've been a name collision with Intellisense but Im not really sure.