Preventing console window from closing on Visual Studio C/C++ Console application

前端 未结 21 1720
灰色年华
灰色年华 2020-11-21 23:42

This is a probably an embarasing question as no doubt the answer is blindingly obvious.

I\'ve used Visual Studio for years, but this is the first time I\'ve done any

21条回答
  •  梦谈多话
    2020-11-22 00:17

    (/SUBSYSTEM:CONSOLE) did not worked for my vs2013 (I already had it).

    "run without debugging" is not an options, since I do not want to switch between debugging and seeing output.

    I ended with

    int main() {
      ...
    #if _DEBUG
      LOG_INFO("end, press key to close");
      getchar();
    #endif // _DEBUG
      return 0;
    }
    

    Solution used in qtcreator pre 2.6. Now while qt is growing, vs is going other way. As I remember, in vs2008 we did not need such tricks.

提交回复
热议问题