This question already has answers here:
Dead code identification (C++)
(7 answers)
Closed 9 years ago.
I've being using Visual Studio 2005 for several years, and usually projects grow and grow, but now I have a project that is going down size, I'm taking away a big chunk of it (almost half of it)... I expected that by deleting the entry point function the compiler would give me a list of unrefrenced functions which I would then delete, and so on until the whole unneeded code was completely deleted... but to my surprise no "unreferenced function" was listed.
I recall in the old days of Turbo C, the compiler immediately protested if there was a function that was not called anywhere... I don't understand why Visual Studio doesn't have this feature, I already checked the properties page throughout and can't find something to help me to get rid of the dead code in a systematic way.
Can Visual Studio detect dead code? if so, how do I enable such feature?
You can use code coverage to determine what parts of your program are being used. Of course you have to be careful because only the code paths taken in the instrumented run are taken into consideration. But anyway this can prove a good start in solving your problem.
Visual Studio 2010 Native C++ Code Coverage Coloring Not Working
I don't think you have C++ code coverage in Visual Studio 2005 but you can try converting your solution to a newer version.
http://msdn.microsoft.com/en-us/library/dd537628.aspx
Did you try enabling level-4 warning? Dead code is not linked into binaries by default, but you can enable warnings each time this happens:
http://msdn.microsoft.com/en-us/library/z85eyax0(v=vs.71).aspx
Related
This question already has answers here:
Error: Cannot access file bin/Debug/... because it is being used by another process
(30 answers)
Closed 4 years ago.
I am trying to run the application on which I am working and from time to time Visual Studio is not able to build the project only because it is locking the executable:
This started to happen after the last update of Visual Studio and it does not happen every build but just from time to time. Closing and reopening the solution removes the error temporary but after a few more builds it comes back.
I am trying to build a solution containing more DLLs and one WPF project and the error seems to be on the WPF one.
Does anybody know how to solve this problem in VS 2017?
I have added the bin folder to the antivirus exclude list, restarted the machine and now it seems to work. For a couple of days Visual Studio is not locking anymore the executable so as #Hans Passant pointed in his comment, it may not be a Visual Studio problem.
I am trying to do some assembly coding, I call the functions from C language. The code itself runs fine, but I have two enormous problems that I cannot to tackle for quite a long time now. First of them is syntax-highlighting - I installed two different (one at the time) asm highlighting extensions to visual studio 2015 enterprise, both of them didn't work. Before I installed the 2015 version I had 2013 Ultimate and the highlighting worked fine there. I tried to delete specific files responsible from registry etc but it didn't help me achieve absolutely anything. Tried to reinstall or update the extensions is well.
Another problem I have is something that pretty much started happening for first time 3 hours ago, in a solution when I have an asm file it is fine, I can edit it freely, run it, whatever. But once I switch off visual studio and run it again in the moment when I try to open the asm file in visual studio the file is no longer in clean assembly but in OP codes written in hexadecimal and along it there is list of the memory cell in which each op is in... When I make new asm file in the solution it is fine but once I restart visual studio same thing happens. I tried to look through all the common options in the top menu bar but there seems not to be anything helpful to me in this situation....
Desperately I tried to google both of those things (first one for quite extended period of time) but it seems like some of the problems I have encountered could possibly be related to 2015 enterprise version of visual studio :(
EDIT// OK I MANAGED TO FIX THE SECOND PROBLEM - right click the .asm file and use Open With and choose another editor!!!
Help please ;(
AsmDude will not work when .asm files are associated with an editor (see this issue here). If you still experiencing problems with AsmDude, consider opening an issue on Github. I'm happy to help you there.
I'm writing a program in C using Visual Studio 2010, and I am getting the following error:
U1095: expanded command line '(here come includes-includes-includes)'.
Some of my colleagues get the same error while others do not. The only easy feasible solution I've tried is to update NMAKE itself from a shady website (NMAKE is very hard to find).
Erasing include entries helps, but eventually we hit the limit again. One hack that works is to use all the includes in a single file per Microsoft's offering and read from that file but I'd prefer to not have to do that.
Is there an official way to update nmake without installing the Windows SDK or Visual Studio 2015?
I would not recommend using anything in programming in general that you "downloaded from a shady source". That sounds like a good way to embed viruses in your shipped code unknowingly. There is no nmake standalone, so you will be forced to use the one that ships with Visual Studio.
Some things you could try:
Attempt using 32-bit and 64-bit versions of nmake and see if you get different results.
Get a more recent version of Visual Studio and see if it works better there.
Thanks a lot for your responses, guys.
Manipulations with nmake didn't help at all.
The answer is: to completely erase a sandbox and get a clean one. So it wasn't MS-VS-2010 problem standalone, but a combination of problems between MS-VS and MKS/PTC Integrity.
I wrote a basic program for my mom, and now I want her to be able to use it. Obviously, it works on my computer. Getting the .exe file from the project folder, and putting it on her computer doesn't work: it says MSVCR120d.dll is missing whenever the .exe is run. Makes sense--as her computer doesn't have Visual Studio on it. However, I tried installing the Visual C++ Redistributable Packages for Visual Studio 2013, and that didn't work either.
To be honest, I'm not looking to spending hours of time to piece this all together. This is something I will more than likely never do again--I've already done some searching and can only find subjects speaking of C++ distributions. I want a way to get the console app on her computer to work.
The more easy way is link statically. That mean embed all the needed code to the app to run, in the final binary (.exe), eliminating dependency of other libraries.
Go to Project Properties
Go to Configuration Properties
Go to C/C++
Go to Code Generation
Change Runtime Library (in Debug to Multi-Threaded Debug /MTd and in Release to Multi-Threaded /MT)
I'm using aptana studio 3 with C code and when I'm writting an acces to an structure it suggests in each position what variables I can use, but for simple variables it doesn't suggests anything without press control+space.
Any idea how to change that?
Aptana Studio doesn't include code completion for C/C++ by default. I would suggest you'll need to contact the plugin authors for C/C++ with that question.