C++ programme does not open in new console window

Anne-Marie Lacey 1 Reputation point
2020-10-04T15:17:26.29+00:00

I wrote first programme and ran it using create new programme/c++/windows/console. Everything worked fine. I created another with the same method, it has no errors but when I run it, the previous console window appears. What am I doing wrong?

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

3 answers

Sort by: Most helpful
  1. WayneAKing 4,921 Reputation points
    2020-10-04T16:19:53.347+00:00

    Which version of Visual Studio are you using?

    When you created the second program did you create a new project?

    Or did you just add a new C++ (*.cpp) file to the existing project?

    Are you using one Solution with one project in it, or one Solution with
    two projects in it? Or two Solutions with one project in each, etc.?

    How you created the Solution, Project(s), and source code files can affect
    what happens when you do a Build and Run. So you need to describe exactly
    what steps you took to create the second program.

    If there are two Projects in one Solution you must specify in the Properties
    which one will get executed.

    • Wayne
    0 comments No comments

  2. Dylan Zhu-MSFT 6,421 Reputation points
    2020-10-05T05:03:25.183+00:00

    Hi AnneMarieLacey-0659,

    According to your description, do you mean that the second program displays the same result in the console? If so, please try to modify the output value in the method, then re-build and re-run your second program.

    If not, could you please provide more details about creating second program and the related code snippets?

    Look forward to your feedback.

    Best Regards,
    Dylan

    0 comments No comments

  3. MMS 05 61 Reputation points
    2020-10-08T10:32:28.737+00:00

    You Might Have Probably Missed the Main Function or Something Else

    0 comments No comments

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.