Visual Studio "Unable to start program " error

KK 0 Reputation points

I have a project in C++ Visual Studio 2022. The code is built well and run in RELEASE mode, but in DEBUG mode the can be built but when I try to run it, the message (see the attachment) come to the screen.

The code was working in its original form. When I added a STRING type variable in some header files, I started getting this error. I can't find out what's causing the problem right now. Because when I define a variable of type INTEGER in the same header file in the same project, I do not receive an error.

I tried cleaning and rebuilding my project in DEBUG mode. It did not work.

Could you please help me?


Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,106 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
884 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Anna Xiu-MSFT 20,486 Reputation points Microsoft Vendor

    Hi @KK

    Welcome to Microsoft Q&A! 

    How did you add string type in the header file? If possible, please share us more details or screenshots about the error message. And you can check the detailed build error in the Output window. 

    Please try the following:

    1. If you have multiple projects in the solution, please go to Solution Explorer > right-click on project node > Set as Startup Project
    2. Close all running VS and enter “devenv /ResetSettings” at Developer Command Prompt for VS 2022 to restore your Visual Studio default settings.
    3. Close VS and manually delete the hidden .vs, bin and obj folders in the project folder. Then, re-launch the VS and rebuild your project.
    4. You can create a new C++ project and verify it again. 



    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.


  2. KK 0 Reputation points

    Thank you Anna, for your response.

    I am sorry, forgot to attach screenshots!


    This is the header file. I have just defined a variable named "kemal" asa type of "string".


    This is the output. It is looking fine.


    but this error comes when I push the Local Windows Debugger button.

  3. KK 0 Reputation points

    I have also tried the same code to run in three different computers, but the result did not change.

    By the way, in the same header file the variables in the string type have been defined before but they are OK. It is interesting because the error only occurs when I try to add new variable in "string" type.