Intellisense in vs2010 with c++

2019-02-17 15:56发布

I can't get intellisense to work. Even if I start with an empty project and add just one file to it with only an include for iostream and an int main() function that prints a char with cout (basically the most basic program), if I try to get intellisense to show anything (say by typing cout.) I get

IntelliSense: 'No additional information available' (See 'Troubleshooting IntelliSense in C++ Projects' for further help.)

Hours of googling have yielded a couple of articles over at the Microsoft sites that suggest a bunch of things to try or reasons why it wouldn't work. I have tried and eliminated them all, except for one that mentions that stdafx.h has to be in the path.

What is this file?
How do I know if it is in the path if I don't know where it is?
What does it have to do with IntelliSense?
Should I add this file to my project to get it to work?

Thank you.

12条回答
趁早两清
2楼-- · 2019-02-17 16:47

Look at this question :C++ VS Express 2010 Intellisense

It was solved by pressing CTRL+J .

EDIT: maybe it's the stdafx.h problem !

Add a file stdafx.cpp and a file stdafx.h to the project ! Use #include "stdafx.h" as yhe first line of code in all your .cpp files. Include all rarely/never changing and frequently used header-files in stdafx.h. Turn on precompiler-headers in your project and rebuild the project.

(Create a dummy project which have precompiled headers on to see how it's been done)

查看更多
祖国的老花朵
3楼-- · 2019-02-17 16:50

Just throwing this out there, you are using namespace std? eg:

std::cout.

because intellisense wont work if it doesn't see cout

edit: I over looked that error message so this isn't the case but leaving the answer in case it might help someone down the line.

查看更多
Evening l夕情丶
4楼-- · 2019-02-17 16:52

baruch's answer worked for me. for completion, here is also the link to the VS2010-SP1: http://www.microsoft.com/en-us/download/details.aspx?id=23691

so first installing this and then the hot-fix that baruch referred to solved me the problem, although the whole installation took almost 1:30 hour! (including one restart on my Win-XP machine.)

查看更多
姐就是有狂的资本
5楼-- · 2019-02-17 16:53

WIN32;_WINDOWS;_DEBUG;Append _DEBUG; remove Append _DEBUG;

查看更多
疯言疯语
6楼-- · 2019-02-17 16:57

I thought I should mention this:

In Visual Studio 2012 I noticed that Intellisense suddenly stopped working in my C++ project (same error as the poster described). This happened because I had added "DEBUG" as a Preprocessor definition under Project Properties -> C/C++ -> Preprocessor.

Once I removed it from that list and instead put it in the code ( #define DEBUG ) intellisense suddenly started working again.

I don't know why this happens, I just know it screws up my intellisense. I hope this helps someone.

查看更多
闹够了就滚
7楼-- · 2019-02-17 16:59

IntelliSense stores it's data in the SQL Server, which is installed during VS2010 setup. I recommend you check if the SQL Server Service is running.

查看更多
登录 后发表回答