I need to remove unused variables and functions(Deadcode) in a c code. Can I use VisualStudio 2013 Pro code analysis to find unused c variables? Because in the rule set, Microsoft.Performance rules are not available for unmanaged code. is there any other tool I can use to find deadcode in c? Will ReSharper help?
Related
Is there a way to limit the MSVC to only support c++11 features but not anything from c++14 or 17?
I am using MSVC++ 14.1 _MSC_VER == 1910 (Visual Studio 2017 version 15.0)
Thanks!
It doesn't appear so. MSVC's C++ compiler does have a /std compiler option, but the documentation only says it can be used as /std:c++14, /std:c++17, or /std:c++latest (to include some features from C++20 drafts).
However, there are not a lot of huge changes between C++11 and C++14, and many of them can be considered "fixes" to things that were inconvenient or just missing from C++11. So maybe /std:c++14 could be close enough for your purposes?
I don't know what specific C++14/17 features are you trying to avoid but you can have a look at Microsoft's Support For C++11/14/17 Features (Modern C++) and select the version of Visual Studio whose feature set is closest to what you are seeking.
You can either use that version of Visual Studio or any later one since Visual Studio supports compilation with older toolsets provided you have them installed.
I am using Visual Studio 2012 VC++ for debugging some of the code. Is it possible to log the list of functions the program is hitting and provide a snapshot of the variable when it hits at the specific point. I am trying to place breakpoint at many places and trying to print the information of the variable. Is there a easy way to do that?? like an extension or plugin or macros..
I tried to search for macros, but I don't find that under tools. Seems that for VC++ they don't provide that option either...
I always program in C# so the last time I installed VS I remember picking C# Mode or something like that. But now, I'm learning C and when I go to new project, C and C++ aren't there at all. What can I do to get these languages back without resetting all of my settings?
Since this was settled in the comments but nobody posted an answer... You just use the C++ compiler and set the option to compile as C code as shown in this figure by Mahesh.
I'm using Visual C++ in Visual Studio 2010 Express, and in the past I remember when you use a string object and after the dot (eg: .) all the member functions will show in list, but that's not happening.
string myString = "hello world";
myString.
After typing the dot, all functions that are part of the string class don't show. Where in Visual C++ is the setting to make them show?
The functionality you refer to is called IntelliSense in Microsoft-speak, their version of autocompletion for variable names, functions, and methods.
IntelliSense is not supported in Visual Studio 2010 for C++/CLI projects. You will only get IntelliSense for projects written in native C++ code. This is explained in more detail here on the Visual C++ Team Blog. There is also a bug filed on Microsoft Connect; the official word is this:
Thanks for your feedback. Unfortunately in this release we had to cut the intellisense support for C++/CLI due to time constraints. If you want to get some intellisense like quick info and memberlist on the native classes you can get it by choosing no /clr support in the project properties.
Thank You!
Visual C++ Team
This is unfortunate news for many of us who work with C++/CLI projects, and we aren't left with many options. A question regarding those options has been asked here: What are people replacing the missing C++/CLI Intellisense in VS 2010 with? The summary is people are either going back to VS 2008
(I believe the Express Edition of 2008 is still available for download if you look around), or purchasing third-party software such as Visual Assist X that promises to bring back IntelliSense.
It's worth mentioning, however, that Microsoft does not regard C++/CLI as a "first-class" .NET language. There's little (if any) reason to start new projects using the language. It's designed for interop purposes between native C++ and managed C# applications. If you want to write C++, you should target the native Windows API (create a new Win32 project in VS). If you want to write managed .NET code, it is highly recommended that you use C# instead (that's a different version of Express that must be downloaded separately). The syntax is very similar between C++ and C#, but you will still have to learn the .NET Framework and idioms. Both native C++ projects and managed C# projects have very much improved IntelliSense support in Visual Studio 2010, so you're guaranteed to be much happier with either of those.
Working with Visual Studio 2008 Pro, with Intel Fortran compiler v11, on Windows 7 x64.
I have an Intel Visual Fortran project set up with all the fortran source files. I wish to gradually replace all these subroutines with C/C++ (actually cuda -- bonus points). Simply right clicking on source files in the solution explorer and "add existing item" will put a .cpp or .c or cuda file in the list... but it never gets compiled. Thus any INTERFACE to C code written into the fortran code always fails on the link step.
How does one get a mixed-language project like this? Google has failed me, and all I find are descriptions of the actual interface code, with no instructions on how to implement the visual studio build system.
Thanks in advance.
A Visual Studio project can only contain code elements from a single language. To mix C++, CUDA and Fortran, you must set up a Visual Studio Solution. Then you are free to integrate multiple languages.
A useful guide to setting up a CUDA multi-language VS 2010 Solution can be found here.
[This answer has been assembled from comments and added as a community wiki to get this question off the unanswered list for the CUDA tag].