Standalone VS 2010 C++ Program

后端 未结 5 598
迷失自我
迷失自我 2021-01-24 09:50

it\'s been a long while since I\'ve used VS 2010 and C++, and as I\'m getting back to using it, I\'m running into the same problems that plagued me last year: the exe\'s that I

5条回答
  •  失恋的感觉
    2021-01-24 10:50

    Open the properties dialog for your project and select Configuration Properties | C/C++ | Code Generation. The default setting is Multi-threaded DLL. Change that to Multi-threaded and you'll be building and .EXE with the run-time statically linked in. Don't forget to do the same for the debug version.

    If you're using MFC or ATL, you will need to navigate to Configuration Properties | General and set "Use of MFC" or "Use of ATL" to link statically as well.

    NB: If you link the runtime statically, you must make sure that any other library you're linking in also links it in statically. Otherwise you'll wind up with two copies of the runtime in memory, each with its own heap and bad things will happen when code using one runtime tries to free an object allocated by the other runtime.

提交回复
热议问题