Hi How to run a c program on visual studio community 2022?

Hamza Rashid 0 Reputation points
2024-04-28T12:55:31.2266667+00:00

Hi, I am a new learner, I am trying to get output from a code but the Local Window Debugger button is not there, I have tried almost every solution I could find but the solution was not there anymore for example one solution told me to go to Tools>Options>Debugging>Redirect all output window to the Immediate window as shown below, User's image

But in my software, there is no debugging,

User's image

I just need to learn how to run the program and get the output, it should not be that difficult, Can Anyone please help?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,648 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 27,546 Reputation points Microsoft Vendor
    2024-04-29T06:05:00.06+00:00

    Hello @Hamza Rashid,

    Welcome to Microsoft Q&A forum.

    Instead of using a file or a folder, please try to create and use a project to build and run(debug) your program. One single file cannot be built or run in Visual Studio.

    You can try to create a new project by using project templates that provided by VS, and type, edit the code in newly created project, then run your program.

    If the code you have is from an existing project, try to get the whole project and open the project(File => Open => Project/Solution) in Visual Studio then run it.

    Besides, it seems that the code you have(from the screenshot) is C#, but you want to use/run a C/C++ program? You may need to first confirm the programming language that you are going to use and select the correct project template. See following screenshots:

    C#:

    User's image

    C++:

    User's image

    Here’s related documentations about

    Create a C++ console app project in Visual Studio

    Build and run a C++ console app project

    Tutorial: Create a simple C# console app in Visual Studio

    Sincerely,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.