I'm trying to make a C++ program, but when I want to test it...

phoenix genie 0 Reputation points
2023-04-03T05:38:14.5666667+00:00

An annoying CMD-like window appears when I am testing the program.

I have been trying to get rid of this CMD-like window because

  1. It's annoying
  2. When I try to close the CMD-like program the C++ program closes as well

I have searched the Internet far and wide, but to no avail.

Can anyone help?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,672 questions
{count} votes

2 answers

Sort by: Most helpful
  1. RLWA32 44,511 Reputation points
    2023-04-03T08:24:55.16+00:00

    @phoenix genie The behavior you describe is typical of an application that creates a gui (windowed) interface but has been created as a console application.

    For example -

    ConsoleDemo

    This can happen if you create your Visual Studio project using the Console Application template or the Empty Project template. Either one of the templates will create a project with the following Linker property -

    SubsysConsole

    To prevent Windows from creating a console window make this change

    SubsysWindows

    However, depending on your application, additional changes to your code may be needed to satisfy linker requirements.

    1 person found this answer helpful.

  2. Minxin Yu 11,351 Reputation points Microsoft Vendor
    2023-04-04T01:50:56.75+00:00

    Hi,phoenix genie
    In addition, Visual Studio provides desktop template project.
    You can create a desktop application through the Windows Desktop Wizard.
    User's image

    enter image description here

    Best regards, Minxin Yu


    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.


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.