您的计算机错误VS2017中缺少C ++ MSVCP120D.dlll

时间:2017-04-29 14:49:42

标签: c++

/*******************************************************************
*    PURPOSE:     To compute Pascal's triangle and illustrate
*                 the use of the debugger.
*    PROGRAMMER:  Leslie Foster
*    REMARKS:     The code below is chosen to illustrate the debugger.
*                 It is neither the most efficient nor the most reliable
*                 way to solve this problem.
*
* From Computing Concepts with C++ Essentials, 3rd ed., Cay S. Horstmann
*************************************************************************/


#include <iostream>
#include <iomanip>
 using namespace std;

/*------------------------------------------------------------------*/

void skip(int n)
/*  PURPOSE:  To skip n spaces on a line
RECEIVES: n - the number of spaces to skip
REMARKS:  n should be non-negative
*/
{
    int i;  /* a counter */

    for (i = 0; i <= n; i++)
        cout << " ";
}
/*------------------------------------------------------------------*/

int factorial(int n)
/*  PURPOSE:  To calculate n factorial
RECEIVES: n - calculate the factorial of n
RETURNS:  n factorial
REMARKS:  n must be >= 0.  Also if n is too large overflow may result
*/
{
    int  product; /*  accumulator for the running product  */
    int  i; /*  a counter  */

    product = 1;
    for (i = 1; i <= n; i++)
    {
        product = product + i;
    }
    return(product);
}

/*------------------------------------------------------------------*/

int combination(int n, int k)
/* PURPOSE:  to calculate the number of combinations of n things taken
k at a time (n choose k)
RECEIVES: n - the number of items to choose from
k - the number of items choosen
RETURNS:  n choose k
REMARKS:  n and k must be non-negative and k <= n.  This program uses
the formula (n choose k) = n! / ( k! * (n-k)! ).
*/
{
    int comb = factorial(n) / factorial(k) * factorial(n - k);

    return comb;
}

/*------------------------------------------------------------------*/

int main(void)
{
    int nrows; /*  the number of rows to print  */
    int n; /*  a counter for the current row  */
    int k; /*  a counter for the current column  */
    int comb; /*  the number of combinations  */
    int spaces_to_skip; /*  spaces to skip  */

    cout << "Enter the number of rows (<=13) in Pascal's triangle: ";
    cin >> nrows;
    cout << "\n\n\n";

    /*  print the title  * /
    skip(16);
    cout << "TABLE 1: THE FIRST " << nrows << " ROWS OF PASCAL'S 
TRIANGLE\n\n";

    / *  start a loop over the number of rows  */
    spaces_to_skip = 36;

    for (n = 0; n < nrows; n = n + 2)
{
    skip(spaces_to_skip); /* space to make a triangle */
    spaces_to_skip = spaces_to_skip - 2;

    for (k = 0; k <= n; k++)
    {
        comb = combination(n, k);
        cout << setw(4) << comb;
    }

    cout << "\n";
}

system("PAUSE");
return 0;
}

我一直试图解决这个错误很长一段时间,我已经尝试在线下载32位和64位的MSVCP120D.dlll文件。我已经尝试将32位文件放入System32文件,将64位文件放入SysWOW64文件中,但这并不能解决错误。任何形式的帮助将不胜感激,谢谢。

1 个答案:

答案 0 :(得分:0)

MSVCP120 D .dll是 debug C / C ++运行时的一部分。您仅在调试版本中获得对该库的依赖性。通常,您不应该分发调试版本,因此您不需要该库。

如果您进行发布版本,则它将取决于MSVCP120.dll,您可以通过安装Visual Studio redistributable package来获取该版本。请注意,MSVCP120.dll是Visual Studio 2013的一部分,而不是您提到的2017年,所以我链接VS2013版本。除此之外,Microsoft将这些DLL捆绑为Visual Studio安装的一部分,以防您希望随软件一起分发它们。在我的机器上,它们位于C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\x64\Microsoft.VC120.CRT。使用较新版本的Visual Studio,只需将这些DLL放在可执行文件旁边即可。对于早期版本,您可以将包含文件夹Microsoft.VC???.CRT放在可执行文件旁边。

最后,即使您不应该重新分发调试CRT DLL,Microsoft仍然将它们作为Visual Studio安装的一部分包含在内。在我的机器上,它们位于C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\Debug_NonRedist\x64\Microsoft.VC120.DebugCRT