Visual Studio "Unable to start program " error

KK 0 Reputation points
2023-11-15T10:12:43.2033333+00:00

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?

Kemal

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,031 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.
987 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Anna Xiu-MSFT 28,576 Reputation points Microsoft Vendor
    2023-11-15T12:40:07.6233333+00:00

    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. 

    Sincerely,

    Anna


    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
    2023-11-15T14:27:50.1366667+00:00

    Thank you Anna, for your response.

    I am sorry, forgot to attach screenshots!

    header_string

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

    output

    This is the output. It is looking fine.

    error

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


  3. KK 0 Reputation points
    2023-11-15T15:19:25.88+00:00

    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.