How to specify an application icon for C++ Visual Studio 2019? - c++

I've seen this documentation for C#/Visual Basic application icons, but there is nothing I can find for how to do this with the C++ version.
This StackOverflow question is for Visual Studio 2008, not 2019. This one is also obsolete, as it works for Visual Studio 2017 but not Visual Studio 2019.

After some fiddling I figured it out. This answer for VS2017 was basically correct, but it didn't fully explain what you have to do to get it to work and the documentation it links to was vague enough to confuse me, so I'll post this answer as the VS2019 version with full and complete easy-to-follow instructions.
Navigate to your Solution Explorer tab.
Find the Resource Files folder in your project, probably near your Header Files and Source Files folders.
Right-click on the Resource Files folder and select "Add > Resource."
In the "Add Resource" window that pops up, select Icon and select Import.
Import either a bitmap file or your custom .ico file.
Now a Resource File (.rc) is created which contains your application Icon, in the form of an Icon node. Click on that .rc file to open the Resource View tab.
You'll see that there's a folder called Icon. It should contain your new icon.
If it contains a default Icon file, probably named IDI_ICON1, you'll have to edit that node to make it the icon you want to use. I don't know why it does that.

Related

I Don't Know How To Use/Run These Files That Are In A Github C++ Library I'm Trying To Add To My Project?

https://github.com/gladosconn/ecdsa_cxxI have been trying to get this library into my project (C++ using Visual Studio 2022, in Windows) because I need to use the ecdsa signature algorithm, I have copied all the files in src folder to a folder called "ecdsa" in the src folder inside my project, and I didn't do anything with the test folders (I think that I don't need them since they're just tests), but then there are these files (.ytml) ,(.txt) ,(.py), I have no idea what am I supposed to do with them or where to put them, but I sure I need them because the program isn't working, it's giving me this error Cannot open include file: 'secp256k1.h': No such file or directory Libraries.Also I have done everything in the requirements section, my compiler supports C++11, and I have installed openssl, and I have CMake installed.This is my first time using anything from Github so I'm sure what to do.
In Visual Studio, right-click on your project in the Solution Explorer pane. From the menu that pops up, choose the 'Properties' item. It is usually at the very bottom. A dialog box will appear.
In the left pane of the dialog box, expand the options Configuration Properties > C++ > General. Now, in the right pane of the dialog box, probably at or near the top will be an item labeled 'Additional Include Directories`. Add the full path to the folder where you copied the source files from GitHub.
You may need to explicitly add ALL the files you downloaded from GitHub into your Visual Studio project.
Try compiling again.

Add Image to Assets Folder UWP C++

Why can't I add images to my UWP assets folder? I usually use C#, but I have to use C++ because I'll eventually be turning this into an optional package (somebody tell me if I'm wrong, and I can write optional packages in C#).
Using Visual Studio, I right click on the Assets folder in the Solutions Explorer click Add->Existing Item and then click on my image. It shows up in Visual Studio, but it doesn't actually get added to the Assets folder so I'm unable to view it when I load my app. I wouldn't think that it matters whether I use C++ or C#, but one is working and not the other.
I've tried rebuilding the project, rebooting the computer, repairing Visual Studio and I'm still stuck.
As suggested by paxbun, I tried using File Explorer to add the file. If I added the file in the Assets folder with the project files, it didn't help. I was able to get the code to work by adding the file to the AppX folder in the Debug folder, but this won't help when I'm ready to release (to make sure, I did a quick sideload).
I haven't put much at all in the code, but you can view it at https://github.com/benjasperson/SimpleCPPImage
Upon further research, I found my answer here.
Clicking "Show all files" in the Solution Explorer and then setting "Include in project" to true was all I needed to do.

Move files in Visual Studio and AnkhSVN simultaneously

I'm reorganizing my project in visual studio. I have some .cpp/.h files which I want to move into a subdirectory physically. A would like to have the following acts simultaneously:
File moving on file system
SVN working copy database updating (with keeping history)
Visual Studio project file(s) updating
Extra benefits would be nice, like:
Updating of #include directives referring to the file.
Are there any solutions? Best workarounds?
This is the proverbial chicken-and-egg dilemma for software developers:
Do you move/rename your files in Visual Studio first then go back to Windows Explorer and correct all the adds/deletes that should really be renames/moves?
Or do you rename/move your files in Windows Explorer then go clean up all the introduced compilation errors in Visual Studio?
You already have the solution at hand! Without AnkhSVN if you do your file operations in Visual Studio you already get two of your requirements: updating your VS project and file system synchronization. With AnkhSVN installed, though, you also get your 3rd requirement: it makes the necessary SVN synchronizations as well. All you have left to do is a commit.
I found the following description from a cached page in a Google search:
In Windows Explorer, right-click and drag the file from its old
location to its new location, then select "SVN move versioned item"
from the context menu. This will not only move the actual file itself,
but it will also make sure that all the file history stays with it
after you check in your changes. Back in Visual Studio, use the
Solution Explorer in VS2010 to "exclude from project" the
(now-missing) copy of the file in its old location, and then "include
in project" the file in its new location. You may need to refresh the
view in solution explorer and/or make sure you are viewing all the
files by clicking the "Show all Files" icon at the top (next to the
refresh icon) in order to see these files.
After you update the namespace to reflect the new location, I
recommend using a global find and replace before you try to compile to
save yourself a lot of trouble.
Hope this helps.

How to change the default *.exe icon in C/C++?

I want to change the default .exe icon to some other icon in C/C++. Does anybody know how to do that?
Already answered.
Change app icon in Visual Studio 2005?
You have to place your .ico file in the resources folder first of course.
Use this one: http://www.angusj.com/resourcehacker/
Since you specified that you are using VS2008 I can point you here: How do I set the icon for my application in visual studio 2008? (duplicate question)
On Windows, if the executable contains many icons, the 1st of them will be the default.
If you have icons resource in your programming environment, place the icon you want first in the list.
Edit: since you created an empty project, to add an icon, follow these instructions:
(as I said in my comment, I don't have VS2008, but the steps should be the same)
Menu: Insert -> Resource -> Import
Select "Icon", press the import button and select your icon file.
Now, close the icon editor, and save the resource script in the project folder.
Select "Files View" and add the resource script file in the "Resource Files".
That's it.
if you are using any ide like dev c++, then you can specify the icon you want to appear on your file in project options

Visual Studio unmanaged C++ smart file explorer

I use Visual Studio to develop unmanaged C++ apps for a living.
Is there an add-on tool (price isnt the issue) that is smart enough to detect folders that I create within my solution folder and add them to the include path (/I)? It would automatically do this for win32, or x64 platform settings, or debug, and release, etc.
It should also be smart enough to remove the include paths if folder is deleted
Arent you frustrated sometimes when you double click a file under solution explorer and Visual Studio says it cant find the file because somebody moved or renamed it? ---> Is there a tool that would periodically scan the files in Solution Explorer and automatically removes or prompts the user to let them know those files are no longer valid?
Like John Lakos once said, I too would pay for an add-on that can automatically add #include into my code by just parsing my project's .h/.cpp files.
When is Visual Studio going to have an Eclipse-like solution explorer that allows user to directly manipuate the files/folders structure directly from within Visual Studio?
You can manipulate files/folders from the IDE! Just click the "show all files" button in the solution explorer (2nd from left, at the top). I just recently found that out.