I am using Visual Studio and C++ to create a console app. I want the exe file to have a custom icon instead of the default windows icon.

I am using Visual Studio and C++ to create a console app. I want the exe file to have a custom icon instead of the default windows icon.

You need to create .rc file (e.g. application.rc) and add it to the Visual Studio project:
IDI_APPLICATION ICON "application.ico"
with the relative path to the .ico file (just the file name if the icon file is in the same directory with .rc file, or use forward slash in path if it is in a subdirectory, e.g. "resources/application.ico").
You could right click your project and select add->resource->Icon->import, then you could import your icon. Because the Windows shell - normally Explorer - will use the icon with lowest ID or name as the default icon. So, you could check if the ID of the icon is the lowest. If not, you could change it.
Also, you could refer to this link .