How to make .exe file from c code using visual studio 2022

Md. Mahim Bin Firoj
3 min readSep 9


I am assuming that you have already installed visual studio 2022 with necessary dot net frameworks and updates.

Let’s start visual studio 2022

Click continue without code.

Go for File>New>Project or press Ctrl+Shift+N

Empty project for c++
console project for c++

Choose a project type depending on your needs. For a simple C program, you can choose “Empty Project” or “Console App” under “C++” if you want a console application. If you have a specific project type in mind (e.g., Windows Forms Application), choose the appropriate template.

We go for empty project for c++

Now we need to set the location where our c code is present. Here in the TMS folder, our c code is present. Now click on Create.

You will see this thing on visual studio application after you click Create in the previous step.

Add>New item

You will see FileName.cpp

For .cpp related code you just need to create the above FileName.cpp file and paste your code over there. See below, the process of pasting .c and .cpp code is same.

Make it as FileName.c as your code is in c.

I am adding the code from below link.

For .cpp you just need to create FileName.cpp file as I told earlier and paste the code in the same area just the above image. Now please note, if you fail to build the .exe from .cpp file in the above way, then check for another solution at the end of this post.

Now add the code from the below link.

Change it from Build to Release

Now Press Ctrl+Shift+B

Its done.

From the c code, exe file has been created.

Alternate solution if the above way .cpp build failed:

Navigate to your kali linux or debian box (In my case). Run the below commands serially one after another.

1. apt install mingw-w64 -y
2. git clone
3. cd C-Reverse-Shell

Now run the below command to compile it:

4. i686-w64-mingw32-g++ re.cpp -o re.exe -lws2_32 -lwininet -s -ffunction-sections -fdata-sections -Wno-write-strings -fno-exceptions -fmerge-all-constants -static-libstdc++ -static-libgcc

Thanks. If you find this article useful please consider to subscribe below.





Md. Mahim Bin Firoj