Is there any way to define auto declarations in visual studio? [duplicate] - c

This question already has an answer here:
Automatic source file preamble in Visual Studio 2010? [closed]
(1 answer)
Closed 8 years ago.
I was wondering, can i define an option (in visual studio) that will include automaticlly a code segment in each and every source code that i will create?
how can i do that?
thanks!

an option (in visual studio) that will include automaticlly a code segment in each and every source code
Assuming "include" as #include and "code segment" to be source code then use option /FL filename.
In VS2010 it's in the project's configuration properties under "C/C++"-->"Advanced" tab.
For reference: http://msdn.microsoft.com/en-us/library/8c5ztk84.aspx

Related

Changing the icon of an exe resulted from building in CodeBlocks [duplicate]

This question already has answers here:
CodeBlocks - How to add an icon to a C program?
(1 answer)
How do I add an icon to a mingw-gcc compiled executable?
(3 answers)
Closed 4 years ago.
I made a little program in C (the content doesn't matter) and built it in CodeBlocks (GNU GCC Compiler), thus resulting in an executable file. I want to change the icon of said .exe file but so far I didnt succeed.
I tried Resource Hacker however the 'change icon option' seems unavailable. Also I dont want to change the icon of a shortcut of the .exe, but having the .exe keep its icon if i send it to someone. Any tips?

Visual Studio is locking the executable which needs to be built [duplicate]

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.

Visual Studio Installer Setup Project [duplicate]

This question already has answers here:
Visual Studio 2017 setup project missing
(6 answers)
VS2017 Setup Project - Where?
(2 answers)
Closed 4 years ago.
I'm wondering how to use Setup Project in Visual Studio 15, which was in
Solution -> Add -> New Project -> .../installed -> Other Project -> Types -> Visual Studio Installer ->Setup Project
but this disappeared. To create an .EXE file for a Windows Form Desktop application, it seems like it is no longer available.
Or how can I access the same functionality with higher versions?
There is an extension that brings it back for backwards compatibility. But at the same time the guidance has been to finally move to a Wix installer or some other installer technology.
The Installer projects are considered deprecated and bad. They can't be easily built using a CI server and more issues.
The proper solution would be:
Use Wix Installer project (if you need Visual Studio project support)
Simple tutorial
Pluralsight
Use something like NullSoft Installer (just build the installer by building it outside of Visual Studio.
If you have an existing investment in the old style installer projects, you can still use the extension. If you're building something new. DON'T. It may be the simplest way of adding an installer, but it'll cause more issues in the long run.

How to detect unreferenced C/C++ code on Visual Studio 2005? [duplicate]

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

intmax_t Data Type in C [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
C++11: intptr_t/int_ptr_t, intmax_t/int_max_t?
I am using C platform on Visual Studio. I want to know that intmax_t datatype is only used for Linux based programming or It is supported by C language(ANSI Language) as well.
Well, both intmax_t and uintmax_t are parts of C99, but some compilers actually need to be shimmed with something like this (or this) to use them. Quoting the main page of the first link here:
This project fills the absence of stdint.h and inttypes.h in Microsoft
Visual Studio. This files were standartized by ISO/IEC as a part of
C99 standard library. If you want to compile or use C99 compliant
project with Microsoft Visual Studio, you will likely find that you're
missing these headers.

Resources