0

I'm having a problem in visual c++ 2010 express, when I try to run my code it runs well, but when I close it, it runs again. So I think the problem was in my code, so I try a very basic code like this.

#include <iostream>

int main()
{
    std::cout << "test" << std::endl;
    return 0;
}

then I try to reset the vc++ settings, but still the .exe is runnning 2x even in the debugger. Then I try to reinstall but still the same problem. I try to import my .exe to other machine to see if it will run 2x, and yes, it runs again after I close it. So I hope someone here can help me fix this problem.

  • I have never ever seen this in the 20+ years I have developed software on windows using windows compilers. – drescherjm Jan 14 '14 at 03:03
  • What do you mean by importing your .exe to an other machine. I mean are you just running the .exe from a USB stick with no visual studio project? – drescherjm Jan 14 '14 at 03:32

1 Answers1

0

It's weird but it's possible.

There is someone who asked before on how to do it: Run multiple instances with one click in Visual Studio (what you are get rid of is sometimes what others desire to have :)). The following notes are borrowed from there. So you can check your visual studio setting whether the followings are set or not. Probably you got the following set. Hope it helps.


  • suppose your current project is A, and it's output is c:\bin\my.exe
  • add an empty project to the solution for A, call it 'Dummy'
  • under Dummy's Project Properties->Debugging set the Command to point c:\bin\my.exe
  • under Solution Properties->Configuration Manager, uncheck all builds of the Dummy project so VS won't try to build it (building an empty project fails)
  • under Solution Properties->Startup Project, select Multiple Startup Projects and set the Action for both A and Dummy to Start
  • now hit F5 and your exe will be launched twice, each under a seperate debugging instance. (as you will be able to see in the Debug->View->Processes window)
Community
  • 1
  • 1
herohuyongtao
  • 49,413
  • 29
  • 133
  • 174