C++ VS Express 2010 Intellisense - c++

I'm trying to use Visual Studio Express 2010 to write an openGL program, so It's a win32 console application. And I can't get Intellisense to show up for anything, openGL or otherwise.
What am I doing wrong, and how can I force Intellisense to show? (Like you can force the Xcode equivalent with Esc)

From MSDN:
IntelliSense can stop working under certain conditions. Use the following steps to help determine why IntelliSense does not work for C++ projects.
To investigate IntelliSense failure in C++ projects
Make sure that the Visual C++ project contains no compilation errors.
1) If the project is a Makefile project, see How to: Enable IntelliSense for Makefile Projects.
2) Make sure that stdafx.h is on the include path. For more information about include paths in Visual C++ projects, see #include Directive (C/C++) and /I (Additional Include Directories).
Also :*General, All Languages, Text Editor, Options Dialog Box
Provides information about how to turn off IntelliSense.
NB.
IntelliSense LimitationsIntelliSense does not work in C++ projects under the following circumstances: ( there more then this one below )
IntelliSense is not fully supported when you reference a header file multiple times by using the #include directive, and the meaning of that header file changes because of various macro states that are defined through the #define directive. In other words, when you include a header file several times and the header usage changes under different macro states, IntelliSense does not always work.

Please find *.sdf file in project directory and delete it relaunch the solution file. It will show your intellisense

Related

IntelliSense in Visual Studio 2019 with CMake Project and IAR Compiler

So I have a CMake project which I open in Visual Studio 2019 with the "Open Folder" option. From here I can build and compile it without any errors (CMake is using the IAR Compiler (iccarm.exe) as specified in the toolchain file). So far so good.
The problem is that IntelliSense, despite finding all necessary header files, shows lots of errors mainly related to "undefined __INTxx_T_TYPE__".
As far as i know thouse double underscores indicate that it's a compiler internal data type, which is not defined in any header file, which would also explain why IntelliSense reports that it's not defined (even if the compiler knows the type). I guess to counter this problem, IntelliSense does support different modes like "windows-msvc-x86" or "linux-gcc-arm". But there is no option for IAR compiler.
So my question: How can I get IntelliSense running in this project ? Is there a way to add a custom IntelliSense mode for the IAR compiler ? Can i add header files only for IntelliSense in which the missing types are defined ? Is there a way to tell IntelliSense not to worry about those types / ignore the types ?
Ok just for the unlikely case someone has the same problem, here is my "solution" (sort of):
I created a header file with all the internal types used by IAR and called it "intellisenseHeader.h". You can find the internals here (https://www.gaio.co.jp/support/user/faq/winams/docs/sample_predef.pdf), but in my case i had to add some definitions by myself. The problem is now, that it won't compile anymore, because the IAR compiler, now finds 2 definitions (the internal definition and the one in the header file). So we need to fix this again:
I put the include inside a #ifdef USE_INTELLISENSE_HEADER.
I created two Visual Studio configurations. In the first one, CMake will set the preprocessor directive and the intellisenseHeader file will get included. In the other one i didn't set it.
So what's the effect of this ? If you are in the configuration, where the header is included, IntelliSense works but you can't compile. And if you are in the other one you can compile, but IntelliSense doesn't work anymore. So now i need to switch between the configurations, everytime i want to compile or write some code... Not the best solution but still better than nothing.
EDIT: Ok just realized you can use __INTELLISENSE__ as mentioned in # Richard Critten comment, and therefore don't need to use multiple configs.

could you remove stdafx.h in visual studio when coding in c++?

i just started learning c++ lately and i am using visual studio 2015. But i have to manually remove the #include stdafx.h in my cpp file before upload it to the test server for my class, or it just sends back an error like this:the error from test server
I would like to know why this issue is happening. My guess is that this thing is exclusive to windows and x86 based OS?
Any help would be appreciated. :D
You'll need to upload all your sources. stdafx.h isn't special in that regard. Of course, if your course restricts you to one .cpp upload, then you can't use stdafx.h for that course
stdafx.h is the default name of a precompiled header for a Visual Studio project. However, you can certainly have a file named this on other environments. Note that the Visual Studio compiler processes this header slightly differently than it does other headers, if it is specified as the precompiled header in your project's property pages (C/C++ -> Precompiled Headers - see here for more details). For example, multiple includes of this file with different preprocessor defines will be ignored when it is the precompiled header (which isn't that common, but something to be aware of).
If you want to make portability to non-Visual Studio environment easier, it's usually easier to disable precompiled headers in your Visual Studio project. If you continue to use the stdafx.h file in your code, you will obviously need to upload it to your test compilation server, and may need to modify it and/or its inclusion into your code.

IntelliSense Including Things that Shouldn't be Included

I'm working on a project in Visual Studio 2010. My project is not supposed to be limited to Windows, however, one of the files is OS-dependant.
For this reason, I have #include <windows.h> in only one of the .cpp files. No other file includes this .cpp files. Therefore, logically, the windows.h header should be invisible to the rest of the solution.
This means that I don't have any name conflicts with declarations in the Windows library in all files but that one .cpp, and my project compiles just fine.
However, IntelliSense keeps on insisting that I have name conflicts. When I press Ctrl+Space, IntelliSense suggests identifiers from windows.h. And this is in the scope where windows.h should be invisible!
Is there a setting I can change to stop this annoying behaviour?
I'm 100% positive that the issue is not with the structure of my solution because if I use an identifier already defined in windows.h in another part of my project, the compiler does not recognize it and it doesn't compile...but IntelliSense recognizes it!
Quoting Andy Rich, a Microsoft employee who works on VC++, from a comment on this blog article: Troubleshooting Tips for IntelliSense Slowness
The browsing database will find all source files that are somehow included in your project, either directly or as a result of other #include directives. This is not configurable, and is necessary in order for the IDE to be able to provide accurate answers.
So unfortunately the answer is no, there's nothing you can do beyond disabling IntelliSense altogether.
Since IntelliSense works on a per-project base (.vcproj), not per-solution (.sln), the easy answer is to move the Windows-specific parts to their own project within your solution.
This also helps with porting, as you can more easily replace the Windows-specific parts.

Visual Studio incorrectly marking inactive code blocks when using `#ifdef`

My project has a bunch of #ifdefs. The macros used by these #ifdefs are usually passed through the command line using the '/D' option to get different build configurations. Visual studio incorrectly assumes that these macros are not defined and greys out the code blocks present inside these #ifdefs. The problem is not syntax highlighting - I can turn the grayed out code to colored code from Options; the main issue is that I am not able to go to the function definition of any functions present inside that #ifdef. I tried reading about Visual Studio hint files but that didn't work for me.
Can anyone help me with this issue? I am using Visual Studio 2008.
Did you define several kinds of builds within VS as Configurations like Debug, Release, or are you building with makefiles? If you haven't taught VS about your /D options then I guess it can't help you. But you should be able to set up Preprocessor Definitions under project properties (Configuration Properties, C/C++, Preprocessor) to get the effect you want, right?
For each option /DMACRO=XXX that you pass to the compiler, specify MACRO=XXX in the IntelliSense Preprocessor Definitions. For each option /DMACRO (no value) that you pass to the compiler, specify MACRO in the IntelliSense preprocessor definitions.
If you're not debugging, and you're just trying to get intellisense or whatever to react, you can always just throw up a quick #define to force the IDE to behave.
Seems you have a similar problem as this fellow:
Can intellisense be enabled in VS2008 within preprocessor directive blocks like #ifndef ... #endif

C++ shift from Unix to Visual Studio in Windows

I am a professional working for a software firm.In my past company basically i was working on C & C++ on unix.Now i suddenly shifted to C++ on Windows and i feel like i am in a completely different world.Basically i am working on a very big application which was totally written in C++.To keep it simple ,i dont have the source code .I have the exe of the application and several other dependent files.it is a GUI application(several windows,reports,graphs and huge mathematical calculations are done by this application).Now i finally have the source code of the application which includes some headers,some vcproj files,some dsw files and several other which i dont even understand why the hell are they present.
Now as i C++ programmer my responsibility is to make all the BUGS that the clients identify replicate and fix them.
If its a bug on unix i can simply use the binary and source code and run gdb/dbx and find out the issue in some or other way like adding adding some printf statements.
But given the files i mentioned above.how could istart debugging an application in VC++ in VISUAL STUDIO.
Is it very difficult for a C++ programmer to shift from Unix to Windows.
Is ther any good resource which i could refer for this kind of change where i could grasp things quickly?
given the exe and the source code of the application how can i start debugging a program by running the application in VS C++-(BTW i am using VS 2005)
The main difference is that on Unix, you'll have Makefiles, which you won't find on Windows. Visual Studio organizes your code in projects and solutions, and those project files contain all the information VS needs to compile&link your projects.
If you have a *.sln file, just double click it to open it in VS. Then build the source (usually by pressing F6) and run in debug mode (usually F5).
More details:
A project is a collection of source files that result in 'something', usually a LIB, a DLL or an EXE.
A solution is a collection of projects. Useful when e.g. one project creates a LIB that is used by another project. When you set dependencies between projects, VS will build the projects in the right order.
Extensions used:
*.vcproj : Project file for C/C++ sources
*.vcproj..user : contains which windows are open in the GUI.
Can safely be deleted.
*.sln : Solution file
*.ncb : Intellisense database for a solution. Can safely be deleted.
*.suo : contains which windows are open in the GUI. Can safely be deleted.
*.dsw : Visual Studio 6.0 related file - not used in VS2005. (Replaced by *.sln IIRC)
./Debug/* : folder with all
intermediate files for a Debug build
(can be changed)
./Release/* : folder with all
intermediate files for a Release
build (can be changed)
That's all I can think of at the moment.
If you only have a .DSW file and not a .SLN file, then it means that the project was probably last worked on with VC6 and not one of the later Visual Studio versions.
That's a shame, because there have been lots of changes to the C++ compiler since VC6, and you're probably going to find the project doesn't compile with VS2005 without needing some minor changes to source code.
Do you have a .SLN file - if so, what's the version number at the top of the file (it's a text file)? If you don't have a .SLN file, can you get hold of VC6?
I would always try to get stuff going on an unfamiliar platform with the best matching tools, before I tried to bring it forward to later versions.
I understand your pain; I took the same path a few months ago.
You probably figured it out, but Visual Studio is not the exact alternative of gcc/g++. It embeds a text editor, a debugger, and so on.
Usually, you have two compilation "modes", debug and release. (you can add your own)
When in debug mode, all optimization are disabled and you can execute your program in the debugger, use step by step, add breakpoints, ...
Just start it using the F5 key.
More notes on the additional files:
In the Visual Studio world, .vcproj files represents "projects": a bunch of file that belongs to the same project (source files, headers, resources, ...).
A .dsw (old name for current .sln files I believe) is a "solution" file: a group of one or several projects which can have internal dependencies. Example: you can have in the same solution, a library and a software that depends on it. So that when you compile the whole solution, things are built in the correct order.
First thing you should try is to attach to the process while it's running (Ctr-Alt-P and select the process) if you have the .pdb (debug information) files you should be able to debug the process without re-building it.
If that fails try to un-check the "Require source files to exactly match the original version" option in Tools -> Options -> Debugging.
If that too fails you'll have to build the application again (by opening the .sln file and performing a build) so that the binary matches your source files.
Good luck.
Compile the code with debug info and press f5 (Start Debugging). I don't see where is the problem. On linux is sort of the same.
VS2005 can convert the dsw file for you to a sln file, but you need all of the original VC6 files in order for the conversion to be successful. For debugging please check out following msdn link, I hope this will help you.
http://msdn.microsoft.com/en-us/library/sc65sadd.aspx
Please select hyperlink "Debugging Native Code" for C++ specific.