C++ IntelliSense 'auto' feature? Where is it? How to get it 'on'? - c++

I would like to enable the IntelliSense 'auto' feature (like the Visual Studio C# 2008 Express) but I am using Visual Studio C++ 2008 Express Edition and in the Tools > Options > Text Editor > C/C++ (there is no option 'IntelliSense' (like Visual C#). How do I get this feature enabled? I know I can get a shortcut in place (CTRL-space etc...)? But how do I get it automatically (the drop down menu)?

In C++, IntelliSense is turned on by default (and AFAIK there isn't even an official way to turn it off). However, when you're coming from C#, you might think it's turned off, because it's so much less powerful in C++. (The reason for this is that C++ is much, much harder to parse. You can find more information on the subject here and here.)
Visual Assist improves C++ considerably (although it might not be all that considerably when you're used to C#), but I don't think you can install plugins in the express edition.

This should be enabled by default. But sometimes for C++ projects it stops working.
Is there a .NCB file in your project folder? If so, close your solution, delete that file, and then re-open your solution and do a rebuild.

I use VC++ 2008 Express Edition as my primary environment. All I can say is that sometimes Intellisense works wonderfully, sometimes it doesn't work at all. The Intellisense parser seems to be slow as can be and stumbles over a lot of cases, especially when templates are involved. Sadly, I just don't think you can count on it being consistently available.

One thing that sometimes helps when intellisense doesn't do what it should, is to delete the .ncb file in the project folder in order to force VS to rebuild the internal database (close VS before deleting the file).

Related

Visual C++ 2010 native Intellisense settings

So, I started programming in C++ moving from Java, Eclipse IDE. I use VS 2010 proffessional, I have it for free from DreamSpark.
However, I am very unhappy with its Intellisense, beeing far far worse than Eclipse (its C++ version) has. But almost everywhere on the internet I read that VS has great, superior Intellisense for native C++. So I want to ask, is there any way, some settings to change to make VS intellisense behave simmiliar to Eclipse? Or is there any other functionality in VS intellisense that compensate that?
To be exact, Eclipse intellisense does much better job guessing what object I want to create, suggests includes, generate keywords, generate few common for cycles etc...
I would not even as this question, but I found somuch possitive feedback on native C++ VS 2010 intellisense, so I have feeling I am doing something wrong... Thanks.
If you are writing managed C++ (C++/CLI) there is a post explaining that intellisense is not currently implemented here
As for alternatives you may like visual assist X.
This question has also been answered before on Stackoverflow. Please see below for some alternative answers and suggestions:
No IntelliSense for C++/CLI in Visual Studio 2010?

Visual Studio environment alternative

I use Visual C++ (7.1 and 8.0) on huge C++ project. The solution contains thousands of files. Visual Assist helps in jumping to function and class definitions. The problem is that it sometimes becomes too slow. I just can't edit a single letter without delay.
Is there some alternative to this environment? I mean something that may read .sln and .vcproj files, use MSVC debugger, compile with MSVC compiler or even use IncrediBuild if necessary. I don't need any sophisticated features. It should be possible to find and open a file by name and jump to function/class definition from place where it is used.
May be Vim with some plugins? Or something else?
It seems there is no alternative to MS Visual studio. I've added separate HDD for source files and it works much better.
Currently i left Visual studio because c++ support just sucks (still using Visual studio 2013 but only for C# projects)
i use NetBeans right now, and really enjoy the refactoring part.
The visual C++ compiler support can be added using a free plugin (VCC4N - Visual C++ Compiler For NetBeans)
good luck

Using a pure C++ compiler versus Visual C++

I searched around for the answers to these questions, but I have had little luck. So, I thought I would post them here to get some clarification. If this is a duplicate, please let me know, and I will close this.
Okay, with that said, I would like to begin learning C++. I come from a C# background and I have a great respect for Visual Studio and what it can do. Now, my question is. How well does Visual Studio's compiler work for C++ as opposed to a non-Microsoft version (such as MinGW)?
My thing is this. I have nothing wrong with Microsoft, but I would really like to learn C++ in a "pure" form and not scewed by any particular implementation. How reliant is Visual C++ on the .NET Framework? Can a "pure" C++ application be created through Visual Studio without any .NET usage or overhead? Does the Visual Studio compiler compile C++ into CIL like it does with C#/VB, or does it compile it all the way down as others do?
Thanks for any help anyone can provide!
The Visual C++ compiler will compile C++ code into standalone EXEs that have nothing to do with the .NET framework.
The only way to get the .NET baggage thrown in is to compile the C++ as "managed".
If you create a new project (File|New|New Project) Then choose "Win32" from the Visual C++ submenu in the project types and choose "Win32 Console Application" Visual studio will create a simple project with a couple of source files that will compile to a little executable.
Most of the time, Visual C++ is very similar to other compilers. Avoid #pragmas, microsoft libraries (MFC, ATL) and you should be fine.
Edit (thanks Cheeso) - Documentation of where Visual C++ diverges from standard.
In general I would advise using boost libraries for threads and networking because they work on many platforms (i.e linux). Also if your code can compile in GCC and Visual Studio then you are doing a good job keeping it portable.
The most recent versions of VC++ have become significantly more compliant to the C++ standard, so it's not really an issue to write "pure" C++ using Visual Studio, presuming that you stay out of the Windows API, COM+ and ATL. In fact, the documentation with Visual Studio is very rich, with details on the standard libraries and the STL, so it can help you learn a great deal. It can't teach you everything, but it's certainly loaded up with a wealth of information that is portable to any compiler and it is very easily accessbible inside the IDE.
If you create a new solution you should choose new Win32 Project, or Win32 Console Application, and check the 'Empty Project' option. Then you can add a main.cpp file, and add your standard C++ code.
If you like Visual Studio, go ahead and use it to learn C++ -- I haven't used the very latest version, but even the previous one was pretty standards-compliant, C++-wise, and I assume the latest one can only have gotten better. You can have many different kinds of project in Visual Studio, including "console apps", which are the "plain vanilla" kind you could make on any platform, and also many other kinds, such as, windows apps using the good old win32 api, ones made with MFC or other frameworks older than .NET, .NET ones using "managed code", etc.
Just make sure you always work in a "console app" project, and you'll be operating pretty closely to how you would be on other platforms and/or with other C++ IDEs.
If you limit yourself to writing ANSI C++ compliant code then what you write in VS will work in other compilers, until you have to interact with a graphic interface or IO. Then you need to make certain that you are using something that is portable, such as OpenGL, and not DirectX.
To set your project the steps here may be useful:
http://bytes.com/topic/net/answers/447572-strict-ansi-c
Microsoft Visual Studio 2005 comes with a very good, C++98 standard compliant pure C++ compiler. If you are interested in pure C++, don't forget to disable language extensions in project settings and you are good to go. Nobody is going to force you to use .NET framework, MFC or anyting like that. Just pure core C++ language and C++ standard library.
Of course, just like any other compiler, it has known non-compliance issues, but in general it is, again, surprisingly good. Older versions of their compiler (MS VS 6.0 specifically) suffered from many non-compliance problems and could not even compile its own header files with language extensions disabled. In 2005 version they fixed a lot of these issues.
After creating a standard Win32 project, you can turn up the compliance a bit more. On the project properties sheet, there's a C/C++ category, with a Language entry. This lists a number of cases where VC++ can differ from the standard. Here, you'd want to turn OFF language extensions, and turn ON "wchar_t as built-in type", "for-loop conformance" and "RTTI support".

Cygwin in Visual Studio

I'm trying to port an old program I wrote for class from KDev in Ubuntu to Windows Visual Studio 2008 using Cygwin as a personal learning exercise. I have the include path configured to include C:\cygwin\usr\include but it doesn't read the .h files properly.
Namely I'm curious as to how one would go about using unix sockets.h functionality in a Visual Studio environment using Cygwin. Has anybody ever got this working or have an easier way to go about doing this?
There are several ways to go about this that could be made to work, depending upon your exact goals. The simplest way is probably just to create a Visual Studio "makefile" project that fires off a custom build command to run a makefile you've built. But that keeps you away from a lot of the nice benefits of Visual Studio as an IDE, so I'm guessing that's not really what you're after.
If you want a more fully integrated solution, you're going to need to do two things. First of all, you're going to need to change out all of your include/library paths to avoid the Microsoft ones and go after the Cygwin ones instead. You can do this by selecting "Tools->Options" from the menu, then choosing "Projects and Solutions->VC++ Directories" from the tree on the left hand side of the window that comes up. You'll have options to change the search directories for executables, headers, libraries, etc. For what you're trying to do, I'd suggest removing everything and adding in just the cygwin directories.
Second, you'll have to tell Visual Studio to use the gcc/g++ compiler. This is a bit trickier. VS supports custom build rules for custom file types... but it seems to have C++ hardwired in for the Microsoft compiler. I don't really know a great way around that except to use your own custom file extension. You can try the standard unix extensions of .c (C files) and .cc (C++ files), but I suspect Visual Studio will automatically pick up on those. You may have to go with something totally foreign.
If you right click on your project in the Solution Explorer and select "Custom Build Rules" you'll be given an interface that will let you create your custom build rules for the file extension you've chosen. The interface is relatively straightforward from there.
This might not get you exactly what you wanted, but it's probably about as close as you're going to get with Visual Studio.
Simply speaking, don't do that. It would be just waste of time. I tried it several times, but always failed. Mostly, I was frustrated by many linking errors, and also was unable to use VS as a debugger.
You can use Visual Studio for editing and browsing source code. It is nice because VS provides the best C/C++ intellisense features (e.g., Auto completion, fast go to definition/declaration). But, it is very hard to use cygwin tool chains with Visual Studio 2008. Visual Studio 2008 is not designed to work with other tool chains. Specifically, you need to change (1) headers, (2) libraries, (3) compiler and (4) linker. However, it is generally very hard, or you need to trade off with the nice features of Visual Studio.
The strongest feature of Visual Studio is its debugging ability such as fully integrated debugging environment and very easy watch windows (e.g., you can see STL vector's element directly in watch windows). However, you can't do this if you would change fundamental tool chain (although I am very suspicious it is even possible to safely build with Visual Studio and cygwin tool chains).
Unfortunately, current Visual Studio 2008 is not for cygwin/MinGW.
This is an old question, but since it comes up first (for SO) on a Google search I wanted to share that it looks like the latest Visual Studio versions do support this.
For instructions, refer to this blog post:
https://blogs.msdn.microsoft.com/vcblog/2017/07/19/using-mingw-and-cygwin-with-visual-cpp-and-open-folder/

Visual Studio: Intellisense Problems and Linux Compatibility

Two somewhat unrelated questions:
Sometimes when I am working on a C++ project in Visual Studio 2008 Express, intellisense just does not want to "work" even though it really should. Auto completion box does not show and status bar says something along the lines of: "Intellisense: No further information is available".
Sometimes it can be fixed by either rebuilding the solution or re-opening the solution, and sometimes even that doesn't work. Is this a known problem? If so: are there any known fixes?
Is there any C++ IDE for Linux that has compatibility with MSVC++'s .sln files? I sometimes want to work on some project without having to go through the hassle of creating a new project and adding the files or manually creating a Make file.
edit:
To answer my own questions:
Apparently there's no real fix other than to try and delete the .ncb file. Alternative would be a different IDE or to use a commercial package replacing intellisense.
Code::Blocks seems to be able to open Visual Studio files. Or at least import them easily.
I posted these together as they both related to visual studio and I didn't deem them important enough to both deserve their own topic.
Do think the downvote is a little harsh though!
Intellisense failing is usually because of a "corrupt" ncb file. The usual solution is to delete it.
Reportly the next version VS 2010 will not be using ncb files anymore.
I've actually had some luckk opening .sln files using Monodevelop.
To avoid creating the Make files by hand try CMake
To answer your second question, there is no way to open .sln files in anything other than Visual Studio. They're a proprietary file type that (it seems) no one has any interest in writing a parser for.
You can however use Visual Studio to generate a makefile automatically. Just use the "Projects > Export Makefile" menu command in Visual Studio.